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:
parent
39213bd00a
commit
72b93ec0d7
3 changed files with 40 additions and 43 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue