From 55b1f7fafef7085638c4c8604b248bbe9fe08124 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 17 Apr 2016 15:43:34 +0000 Subject: MirLua: - added function topointer into _G - overrided tonumber to support pointers - api methods is only support light userdata as wparam/lparam git-svn-id: http://svn.miranda-ng.org/main/trunk@16697 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_core.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugins/MirLua/src/m_core.cpp') diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index 6ec526101e..3b7e841c1e 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -360,6 +360,15 @@ static int core_TerminateThread(lua_State *L) return 1; } +int core_ptr2number(lua_State *L) +{ + ObsoleteMethod(L, "Use tonumber(x) instead"); + + luaL_checktype(L, 1, LUA_TLIGHTUSERDATA); + lua_pushnumber(L, (intptr_t)lua_touserdata(L, 1)); + return 1; +} + luaL_Reg coreApi[] = { { "CreateHookableEvent", core_CreateHookableEvent }, @@ -389,7 +398,7 @@ luaL_Reg coreApi[] = { "ForkThread", core_ForkThread }, { "TerminateThread", core_TerminateThread }, - { "PointerToNumber", luaM_ptr2number }, + { "PointerToNumber", core_ptr2number }, { "GetFullPath", core_GetFullPath }, -- cgit v1.2.3