I'm new to Love2D and Lua, but am having a lot of fun working with it.
I'm trying to write a function to restore game state from a file, and want to be able to search for object to set up by looking at the globals which are defined. I found this page:
http://www.lua.org/manual/2.4/node31.html
which suggests that nextvar can be used to iterate over the globals:
Code: Select all
function printGlobalVariables ()
local i, v = nextvar(nil)
while i do
print(i)
i, v = nextvar(i)
end
end
Error: [string "pac.lua"]:1045: attempt to call global 'nextvar' (a nil value)
I'm not sure whether this is a Love2D environment issue, a Lua install/version issue, or that the documentation I've found is just wrong. Can anyone help?
Cheers,
Richard