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

Function LuaGetType

engine/gui/src/gui_script.cpp:576–602  ·  view source on GitHub ↗

gets the node type * * @name gui.get_type * @param node [type:node] node from which to get the type * @return type [type:constant] type * * - `gui.TYPE_BOX` * - `gui.TYPE_TEXT` * - `gui.TYPE_PIE` * - `gui.TYPE_PARTICLEFX` * - `gui.TYPE_CUSTOM` * * @return subtype [type:number|nil] id of the custom type */

Source from the content-addressed store, hash-verified

574 * @return subtype [type:number|nil] id of the custom type
575 */
576 static int LuaGetType(lua_State* L)
577 {
578 int top = lua_gettop(L);
579 (void) top;
580
581 dmGui::HScene scene = dmGui::GuiScriptInstance_Check(L);
582
583 HNode hnode;
584 LuaCheckNodeInternal(L, 1, &hnode);
585
586 dmGui::NodeType type = dmGui::GetNodeType(scene, hnode);
587 lua_pushnumber(L, type);
588
589 if (type == NODE_TYPE_CUSTOM)
590 {
591 uint32_t subtype = dmGui::GetNodeCustomType(scene, hnode);
592 lua_pushnumber(L, (lua_Number) subtype);
593 }
594 else
595 {
596 lua_pushnil(L);
597 }
598
599 assert(top + 2 == lua_gettop(L));
600
601 return 2;
602 }
603
604 /*# sets the id of the specified node
605 *

Callers

nothing calls this directly

Calls 8

lua_gettopFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
LuaCheckNodeInternalFunction · 0.85
lua_pushnumberFunction · 0.85
GetNodeCustomTypeFunction · 0.85
lua_pushnilFunction · 0.85
GetNodeTypeFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected