diff --git a/SDK/include/NDK/LuaAPI.inl b/SDK/include/NDK/LuaAPI.inl index 1f9780200..3eee85bc1 100644 --- a/SDK/include/NDK/LuaAPI.inl +++ b/SDK/include/NDK/LuaAPI.inl @@ -308,9 +308,22 @@ namespace Nz return ret; } + inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::Entity** handle, TypeTag) + { + if (!state.IsOfType(index, LuaType_Nil)) + *handle = *static_cast(state.CheckUserdata(index, "Entity")); + else + *handle = nullptr; + + return 1; + } + inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::EntityHandle* handle, TypeTag) { - *handle = *static_cast(state.CheckUserdata(index, "Entity")); + if (!state.IsOfType(index, LuaType_Nil)) + *handle = *static_cast(state.CheckUserdata(index, "Entity")); + else + handle->Reset(); return 1; }