Sure you can:
lua code:
function write_result(stream, desc, func)
a = func()
stream:write(string.format("%s: \n", desc))
for k,v in pairs(a) do
stream:write(string.format("\t%s = %s\n", k, v))
end
end
f = io.open("tables.txt", "w")
write_result(f, "Player Info Table", function() return get_player_info(0) end)
write_result(f, "World State Table", function() return get_world_state() end)
f:close()
echo("Done")
This script outputs the keys and current values into "tables.txt". It's simple to add new functions, just add in another write_result under the others, for example:
lua code:
write_result(f, "Body Info Table", function() return get_body_info(0, 0) end)
Here's what running it output for me in a new game:
Player Info Table:
num_textures = 13
injury = 0
name = Blam
score = 0
World State Table:
winner = -1
selected_body = -1
replay_mode = 0
selected_joint = -1
turn_timeout = 38447
selected_player = 0
num_bouts = 0
game_paused = 0
turn_timelimit = 15
game_type = 0
frame_tick = 70355
game_frame = 500
reaction_time = 15
num_players = 2
turn_frame = 0
match_frame = 0
If you just want a quick refference, running the SDK file for a function that returns a table should echo all of the keys and their current values.
/ls sdk/get_game_rules.lua
Last edited by Blam; Jul 22, 2012 at 02:52 PM.