View Single Post
04/30/14, 02:08 PM   #13
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Originally Posted by skyraker View Post
I've seen plenty of examples online of how to accomplish it using loadstring, but I've gone through just about every method of using it and cannot get it to work.
That's unlikely, because it's not possible. loadstring is always executed in the global scope. You can neither reference local variables nor local functions inside the string of a loadstring() (unless you declare them within the loadstring itself).

i = 0
local i = 5
f = loadstring("i = i + 1")
f()
i = i - 1

The result will be:
i = 1
local i = 4
  Reply With Quote