From 2258b1b2cf951347d167d01201f0dc4bbf9a4428 Mon Sep 17 00:00:00 2001 From: aunsane Date: Tue, 26 Sep 2017 23:32:12 +0300 Subject: MirLua: refactoring - respect metatables in print function - srmm module functions now return metatable - version bump --- plugins/MirLua/include/mirlua.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/MirLua/include/mirlua.h') diff --git a/plugins/MirLua/include/mirlua.h b/plugins/MirLua/include/mirlua.h index eee10289bb..6cf96011ff 100644 --- a/plugins/MirLua/include/mirlua.h +++ b/plugins/MirLua/include/mirlua.h @@ -14,8 +14,12 @@ __forceinline UINT_PTR luaM_tomparam(lua_State *L, int idx) case LUA_TLIGHTUSERDATA: return (UINT_PTR)lua_touserdata(L, idx); case LUA_TNUMBER: - if (lua_isinteger(L, idx)) - return (UINT_PTR)lua_tointeger(L, idx); + { + lua_Integer res = 0; + lua_Number num = lua_tonumber(L, idx); + if (lua_numbertointeger(num, &res)) + return res; + } } return NULL; } -- cgit v1.2.3