File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Shared/mods/deathmatch/logic/lua Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,17 @@ struct CLuaFunctionParserBase
320320 // Catch all for class pointer types, assume all classes are valid script entities
321321 // and can be fetched from a userdata
322322 else if constexpr (std::is_pointer_v<T> && std::is_class_v<std::remove_pointer_t <T>>)
323- return iArgument == LUA_TUSERDATA || iArgument == LUA_TLIGHTUSERDATA;
323+ {
324+ if (iArgument != LUA_TUSERDATA && iArgument != LUA_TLIGHTUSERDATA)
325+ return false ;
326+
327+ using class_t = std::remove_pointer_t <T>;
328+ int tempIndex{index};
329+ void * pValue = lua::PopPrimitive<void *>(L, tempIndex);
330+ auto result = iArgument == LUA_TLIGHTUSERDATA ? UserDataCast ((class_t *)pValue, L) :
331+ UserDataCast (*reinterpret_cast <class_t **>(pValue), L);
332+ return result != nullptr ;
333+ }
324334
325335 // dummy type is used as overload extension if one overload has fewer arguments
326336 // thus it is only allowed if there are no further args on the Lua side
You can’t perform that action at this time.
0 commit comments