I did a little test to try and read their captions, and found that their captions weren't strings. So I grabbed them with:
Code: Select all
function print_top_button_captions (player)
local message = ""
for _,name in pairs(player.gui.top.children_names) do
local child = player.gui.top[name]
message = message .. serpent.dump(child.caption) .. "\n"
end
game.write_file("mod-panel/test.txt", message)
end
Code: Select all
do local _={[1]="main-button"};return _;end
do local _="function: 0000000037D10730";return _;end
do local _={[1]="toy-box-button-collapsed-text"};return _;end
do local _="Mod Panel";return _;end
Now the documentation for caption makes the following "promise":
How can I resolve those returned items to the caption strings or otherwise get the text displayed on the element?caption : string [Read-Write]: The text displayed on the element. ... For other elements, like buttons or labels, this is the content.