Hey all.
I just discovered loadstrings and experimented a little. I was puzzled when I saw these results.
1 | location = loadstring (script.Parent:GetFullName()) |
2 | test = loadstring ( "b = 5" ) |
3 | print (location,test) |
Here's my result:
nil function: 369C82A8
When I ran it without the test
variable, it returned nil
- Which is probably the same with the test variable. what I expected was workspace.Part
for location
and 5 for test.
Can someone please clarify loadstrings for me?
Thanks
You recieved that output due to the fact that loadstring returns a function. You still have to call this function in order to play your code. What you did was created the function to call, and then printed it.
Try it this way;
1 | loadstring ( "test = 5" )() |
2 | loadstring ( "location = script.Parent:GetFullName()" )() |
3 |
4 | print (test,location) |