diff --git a/src/frontend/mame/luaengine.ipp b/src/frontend/mame/luaengine.ipp index 8af5a937eb4..9d17bbba054 100644 --- a/src/frontend/mame/luaengine.ipp +++ b/src/frontend/mame/luaengine.ipp @@ -92,9 +92,10 @@ protected: auto p(sol::stack::unqualified_check_get(L, 1)); if (!p) luaL_error(L, "sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)", sol::detail::demangle().c_str()); - if (*p) + else if (!*p) luaL_error(L, "sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type", sol::detail::demangle().c_str()); - return **p; + else + return **p; } struct indexed_iterator