1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix ObjectRef errors due to lua_isnil() (#10564)

Treat 'none' values as 'nil'
This commit is contained in:
Zughy 2020-11-04 21:43:18 +01:00 committed by GitHub
parent 39213bd00a
commit 72b93ec0d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 43 deletions

View file

@ -50,5 +50,8 @@ protected:
* @return read value from Lua or default value if nil
*/
template <typename T>
static T readParam(lua_State *L, int index, const T &default_value);
static inline T readParam(lua_State *L, int index, const T &default_value)
{
return lua_isnoneornil(L, index) ? default_value : readParam<T>(L, index);
}
};