gets the id of an instance * Returns or constructs an instance identifier. The instance id is a hash * of the absolute path to the instance. * * - If `path` is specified, it can either be absolute or relative to the instance of the calling script. * - If `path` is not specified, the id of the game object instance the script is attached to will be returned. * * @n
| 1473 | * ``` |
| 1474 | */ |
| 1475 | int Script_GetId(lua_State* L) |
| 1476 | { |
| 1477 | ScriptInstance* i = ScriptInstance_Check(L); |
| 1478 | if (lua_gettop(L) > 0) |
| 1479 | { |
| 1480 | const char* ident = luaL_checkstring(L, 1); |
| 1481 | dmScript::PushHash(L, GetAbsoluteIdentifier(i->m_Instance, ident)); |
| 1482 | } |
| 1483 | else |
| 1484 | { |
| 1485 | dmScript::PushHash(L, i->m_Instance->m_Identifier); |
| 1486 | } |
| 1487 | return 1; |
| 1488 | } |
| 1489 | |
| 1490 | static lua_State* GetLuaState(ScriptInstance* instance) { |
| 1491 | return instance->m_Script->m_LuaState; |
nothing calls this directly
no test coverage detected