I’ve tried to find the solution to the problem below online, but with no success. Perhaps any of you wizards here know what mistake I’m making?
The following works:
func = loadstring("return 1") a = func() print(a) -- will print 1
The following will just print nil. I expect the same behavior as above:
function test() return 1 end func = loadstring("test()") a = func() print(a) -- will print nil. assumed to print 1.
Am I trying to do something impossible? Perhaps I’m missing something when it comes to environment setting?
Any help is highly appreciated!