Enumerate "game" object via LUA?
Posted: Thu Feb 07, 2019 4:45 am
There is no good place for this question. This isn't really modding but more about learning LUA and poking around at stuff.
Is there some way to query the "game" object to list all of its functions? I am trying to get a list of things like "game.player", "game.surface", etc.
Apparently it's a table but using pairs() doesn't do anything.
/c local count = 0 for _ in pairs(game) do count = count + 1 game.player.print("Table entry: " .. _) end game.player.print("Total entries: " .. count)
Output:
Table entry: __self
Total entries: 1
So, that's not the right way to do this, if it is even possible..
Is there some way to query the "game" object to list all of its functions? I am trying to get a list of things like "game.player", "game.surface", etc.
Apparently it's a table but using pairs() doesn't do anything.
Code: Select all
/c
local count = 0
for _ in pairs(game) do
count = count + 1
game.player.print("Table entry: " .. _)
end
game.player.print("Total entries: " .. count)
Output:
Table entry: __self
Total entries: 1
So, that's not the right way to do this, if it is even possible..