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 |
|
|
|
| 05 Jul 2013 02:07 AM |
loadstring() is used to load saved data...
Hello?
Randall Boggs = Doom Bucket > 7 > Blu > Emp+Est |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 02:08 AM |
Specifically, loads a string.
Randall Boggs = Doom Bucket > 7 > Blu > Emp+Est |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 05 Jul 2013 02:19 AM |
| @Dennis can you give a brief example? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 05 Jul 2013 02:30 AM |
| @Cody - thanks you're good at explaining this stuff. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|