MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / SetSceneNodeFunc

Method SetSceneNodeFunc

src/lua/LuaSceneNode.cpp:412–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410
411
412int LuaSceneNodeMgr::SetSceneNodeFunc(lua_State* L) {
413 LuaSceneNode* sceneNode = CheckLuaSceneNode(L, 1);
414
415 const int type = lua_type(L, 2);
416 if ((type != LUA_TNIL) && (type != LUA_TFUNCTION)) {
417 luaL_error(L, "bad function type");
418 }
419
420 if (sceneNode == NULL) {
421 lua_settop(L, 1);
422 return 1;
423 }
424
425 int& ref = sceneNode->renderNode.funcRef;
426 if (ref != LUA_NOREF) {
427 luaL_unref(L, LUA_REGISTRYINDEX, ref);
428 ref = LUA_NOREF;
429 }
430 if (type == LUA_TFUNCTION) {
431 lua_settop(L, 2);
432 ref = luaL_ref(L, LUA_REGISTRYINDEX);
433 }
434 lua_settop(L, 1);
435 return 1;
436}
437
438
439int LuaSceneNodeMgr::SetSceneNodeData(lua_State* L) {

Callers

nothing calls this directly

Calls 6

CheckLuaSceneNodeFunction · 0.85
lua_typeFunction · 0.50
luaL_errorFunction · 0.50
lua_settopFunction · 0.50
luaL_unrefFunction · 0.50
luaL_refFunction · 0.50

Tested by

no test coverage detected