summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/src/mlua_utils.cpp')
-rw-r--r--plugins/MirLua/src/mlua_utils.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp
index 26bcf22657..d3002cb04c 100644
--- a/plugins/MirLua/src/mlua_utils.cpp
+++ b/plugins/MirLua/src/mlua_utils.cpp
@@ -167,13 +167,19 @@ int luaM_tonumber(lua_State *L)
lua_Integer value = (lua_Integer)lua_touserdata(L, 1);
lua_pushinteger(L, value);
}
- else
+ else if (lua_gettop(L) == 2)
{
lua_getglobal(L, "_tonumber");
lua_pushvalue(L, 1);
lua_pushvalue(L, 2);
luaM_pcall(L, 2, 1);
}
+ else
+ {
+ lua_getglobal(L, "_tonumber");
+ lua_pushvalue(L, 1);
+ luaM_pcall(L, 1, 1);
+ }
return 1;
}