Replies: 3 comments
-
This is not a GopherLua specific question, so you can do it with pure Lua codes. local keys = {}
setmetatable(_G, {
__newindex = function(t, i, v)
table.insert(keys, i)
rawset(t, i, v)
end
})
function f1()
print("f1")
end
function f2()
print("f2")
end
for i, key in ipairs(keys) do
print(tostring(i) .. ":" .. key)
end Refer to Lua 5.1 reference manual for details. |
Beta Was this translation helpful? Give feedback.
-
Cool, can I make the same think using the gopher-lua API? I currently loop through all the objects in |
Beta Was this translation helpful? Give feedback.
-
I pasted your code into a |
Beta Was this translation helpful? Give feedback.
-
Hello,
can I iterate through LValue values in the
_G
global state in order that they're written in the script. Concretely, I would like to execute functions in the up-to-down order. Is that possible?Beta Was this translation helpful? Give feedback.
All reactions