We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5376a2f commit 1678632Copy full SHA for 1678632
src/xrScriptEngine/Functor.hpp
@@ -42,10 +42,14 @@ template<typename T>
42
struct default_converter<functor<T>> : native_converter_base<functor<T>>
43
{
44
static int compute_score(lua_State *luaState, int index)
45
- { return lua_type(luaState, index)==LUA_TFUNCTION ? 0 : -1; }
+ { return lua_isfunction(luaState, index) || lua_isnil(luaState, index) ? 0 : -1; }
46
47
functor<T> from(lua_State *luaState, int index)
48
- { return object(from_stack(luaState, index)); }
+ {
49
+ if (lua_isnil(luaState, index))
50
+ return functor<T>();
51
+ return object(from_stack(luaState, index));
52
+ }
53
54
void to(lua_State *luaState, const functor<T> &func)
55
{ func.push(luaState); }
0 commit comments