MCPcopy Create free account
hub / github.com/defold/defold / LuaSetId

Function LuaSetId

engine/gui/src/gui_script.cpp:628–651  ·  view source on GitHub ↗

sets the id of the specified node * * Set the id of the specicied node to a new value. * Nodes created with the gui.new_*_node() functions get * an empty id. This function allows you to give dynamically * created nodes an id. * * [icon:attention] No checking is done on the uniqueness of supplied ids. * It is up to you to make sure you use unique ids. *

Source from the content-addressed store, hash-verified

626 * ```
627 */
628 static int LuaSetId(lua_State* L)
629 {
630 int top = lua_gettop(L);
631 (void) top;
632
633 Scene* scene = GuiScriptInstance_Check(L);
634 HNode hnode;
635 LuaCheckNodeInternal(L, 1, &hnode);
636
637 dmhash_t id = 0;
638 if (lua_isstring(L, 2))
639 {
640 id = dmHashString64(lua_tostring(L, 2));
641 }
642 else
643 {
644 id = dmScript::CheckHash(L, 2);
645 }
646 dmGui::SetNodeId(scene, hnode, id);
647
648 assert(top == lua_gettop(L));
649
650 return 0;
651 }
652
653 /*# gets the named property of a specified gui node
654 *

Callers

nothing calls this directly

Calls 7

lua_gettopFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
LuaCheckNodeInternalFunction · 0.85
lua_isstringFunction · 0.85
CheckHashFunction · 0.85
SetNodeIdFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected