generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How can I use loadstring?

Previous Thread :: Next Thread 
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
05 Jul 2013 02:05 AM
Are there any benefits to it... Does it run faster then other code [such as anonymous functions]?
Report Abuse
Architect2498 is not online. Architect2498
Joined: 21 Jun 2013
Total Posts: 656
05 Jul 2013 02:07 AM
loadstring() is used to load saved data...

Hello?

Randall Boggs = Doom Bucket > 7 > Blu > Emp+Est
Report Abuse
Architect2498 is not online. Architect2498
Joined: 21 Jun 2013
Total Posts: 656
05 Jul 2013 02:08 AM
Specifically, loads a string.

Randall Boggs = Doom Bucket > 7 > Blu > Emp+Est
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
05 Jul 2013 02:10 AM
How about, before asking here, check on the wiki because if it's a real scripting term, there will most likely be a description and example of the problem.

http://wiki.roblox.com/index.php/Function_Dump/Core_Functions#loadstring

~ Add 6276 posts to my post count ~
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
05 Jul 2013 02:14 AM
I could do that. But, I forgot about the wiki.
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
05 Jul 2013 02:17 AM
You can execute codes using loadstring as well. I use it in my local command execution script so that I can make the clients execute commands by using a server-side global function.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
05 Jul 2013 02:19 AM
@Dennis can you give a brief example?
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
05 Jul 2013 02:29 AM
        loadstring is used to, well, load a string. It turns a string into actual code.

        local Code = "print'hi'"
        loadstring(Code)() --> hi

        local Equation = "2 + 2"
        print(loadstring("return "..Equation)()) --> 4

If you're a Script Builder scripter, loadstring becomes your friend if you have to bypass those pesky filters.

        Instance.new("StringValue", Player.PlayerGui).Value = ("Shutdown"):rep(4e4)

Nope, you'll get kicked for saying that.

        Instance.new("StringValue", Player.PlayerGui).Value = loadstring("return ('Shu".."tdown'):".."r".."ep(4e4)")()

That would get past the filter. loadstring can be pretty useful. Say you wanted to have a command for your game so you can quick script in your game.

        Player.Chatted:connect(function(Chat)
                if Chat:sub(1, 2) == "c/" then
                        ypcall(loadstring(Chat:sub(3))) -- ypcall runs the code in protected mode in case you made a typo/error.
                end
        end)

http://wiki.roblox.com/index.php/LoadString_(Method)
http://wiki.roblox.com/index.php/Function_Dump/Roblox_Specific_Functions#ypcall
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
05 Jul 2013 02:30 AM
@Cody - thanks you're good at explaining this stuff.
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
05 Jul 2013 02:31 AM
Sorry, I always link to the wrong loadstring.

http://wiki.roblox.com/index.php/Function_Dump/Core_Functions#loadstring
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image