get a node including its children * Get a node and all its children as a Lua table. * * @name gui.get_tree * @param node [type:node] root node to get node tree from * @return clones [type:table] a table mapping node ids to the corresponding nodes */
| 4001 | * @return clones [type:table] a table mapping node ids to the corresponding nodes |
| 4002 | */ |
| 4003 | static int LuaGetTree(lua_State* L) |
| 4004 | { |
| 4005 | int top = lua_gettop(L); |
| 4006 | (void)top; |
| 4007 | |
| 4008 | lua_newtable(L); |
| 4009 | |
| 4010 | // Set meta table to convert string indices to hashes |
| 4011 | lua_createtable(L, 0, 1); |
| 4012 | lua_pushcfunction(L, HashTableIndex); |
| 4013 | lua_setfield(L, -2, "__index"); |
| 4014 | lua_setmetatable(L, -2); |
| 4015 | |
| 4016 | Scene* scene = GuiScriptInstance_Check(L); |
| 4017 | if (!lua_isnil(L, 1)) |
| 4018 | { |
| 4019 | dmGui::HNode hnode; |
| 4020 | InternalNode* root = LuaCheckNodeInternal(L, 1, &hnode); |
| 4021 | PushNodeToTable(L, scene, root); |
| 4022 | } |
| 4023 | else |
| 4024 | { |
| 4025 | PushNodeListToTable(L, scene, scene->m_RenderHead); |
| 4026 | } |
| 4027 | |
| 4028 | assert(top + 1 == lua_gettop(L)); |
| 4029 | return 1; |
| 4030 | } |
| 4031 | |
| 4032 | /*# resets all nodes to initial state |
| 4033 | * Resets all nodes in the current GUI scene to their initial state. |
nothing calls this directly
no test coverage detected