| 410 | |
| 411 | |
| 412 | int 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 | |
| 439 | int LuaSceneNodeMgr::SetSceneNodeData(lua_State* L) { |
nothing calls this directly
no test coverage detected