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

Function NodeProxy_tostring

engine/gui/src/gui_script.cpp:368–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366 }
367
368 static int NodeProxy_tostring (lua_State *L)
369 {
370 DM_LUA_STACK_CHECK(L,1);
371
372 NodeProxy* np = NodeProxy_Check(L, 1);
373
374 if (np->m_Scene == GetScene(L))
375 {
376 InternalNode* n = 0;
377
378 if (IsValidNode(np->m_Scene, np->m_Node))
379 {
380 n = GetNode(np->m_Scene, np->m_Node);
381 }
382 else
383 {
384 luaL_error(L, "Deleted node");
385 }
386
387 Vector4 pos = n->m_Node.m_Properties[PROPERTY_POSITION];
388 switch (n->m_Node.m_NodeType)
389 {
390 case NODE_TYPE_BOX:
391 lua_pushfstring(L, "box@(%f, %f, %f)", pos.getX(), pos.getY(), pos.getZ());
392 break;
393 case NODE_TYPE_TEXT:
394 lua_pushfstring(L, "%s@(%f, %f, %f)", n->m_Node.m_Text, pos.getX(), pos.getY(), pos.getZ());
395 break;
396 case NODE_TYPE_CUSTOM:
397 lua_pushfstring(L, "custom_%d@(%f, %f, %f)", n->m_Node.m_CustomType, pos.getX(), pos.getY(), pos.getZ());
398 break;
399 case NODE_TYPE_PARTICLEFX:
400 lua_pushfstring(L, "particlefx@(%f, %f, %f)", pos.getX(), pos.getY(), pos.getZ());
401 break;
402 default:
403 lua_pushfstring(L, "unknown@(%f, %f, %f)", pos.getX(), pos.getY(), pos.getZ());
404 break;
405 }
406 }
407 else
408 {
409 lua_pushliteral(L, "<foreign scene node>");
410 }
411
412 return 1;
413 }
414
415 static int NodeProxy_index(lua_State *L)
416 {

Callers

nothing calls this directly

Calls 9

NodeProxy_CheckFunction · 0.85
GetSceneFunction · 0.85
IsValidNodeFunction · 0.85
luaL_errorFunction · 0.85
lua_pushfstringFunction · 0.85
GetNodeFunction · 0.70
getXMethod · 0.45
getYMethod · 0.45
getZMethod · 0.45

Tested by

no test coverage detected