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")
write_result(f, "Body Info Table", function() return get_body_info(0, 0) end)
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
\n New line
\t Tab (Big space, for indenting)
%s Where the parameter will go.
Example:k = "Hello"
v = "World"
output = string.format("\t%s = '%s'\n", k, v)
echo(output)
-- Hello = 'world'
--
key | value
---------------+---------
winner | -1
selected_body | -1
replay_mode | 0
selected_joint | 0
name | Blam
To iterate over a key pair table, you use the pairs function like this:world_state = get_world_state()
for key, value in pairs(world_state) do
echo(key .. " = " .. value)
end
function run_protocol(str)
run_cmd("cp \n"..str)
end
And you can then use:run_protocol("SAY random non-important evil string")
To make your character say that.