From 72b93ec0d75e97ec343e5b936b858d686580677d Mon Sep 17 00:00:00 2001 From: Zughy <63455151+Zughy@users.noreply.github.com> Date: Wed, 4 Nov 2020 21:43:18 +0100 Subject: Fix ObjectRef errors due to lua_isnil() (#10564) Treat 'none' values as 'nil' --- src/script/common/helper.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/script/common/helper.h') diff --git a/src/script/common/helper.h b/src/script/common/helper.h index d639d6e16..7a794dc9b 100644 --- a/src/script/common/helper.h +++ b/src/script/common/helper.h @@ -50,5 +50,8 @@ protected: * @return read value from Lua or default value if nil */ template - 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(L, index); + } }; -- cgit v1.2.3