From 811d9e210f874330efb182cd701e2f69d35c5210 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 18 Jan 2016 13:04:16 +0000 Subject: MirLua: luserdata -> number convert function git-svn-id: http://svn.miranda-ng.org/main/trunk@16120 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_core.cpp | 4 +++- plugins/MirLua/src/mlua_utils.cpp | 7 +++++++ plugins/MirLua/src/stdafx.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index e2e34ea717..339a2e8419 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -275,12 +275,14 @@ luaL_Reg coreApi[] = { "Utf8DecodeA", core_Utf8DecodeA }, { "Utf8DecodeW", core_Utf8DecodeW }, - + { "Free", core_Free }, { "Translate", core_Translate }, { "ReplaceVariables", core_ReplaceVariables }, + { "PointerToNumber", luaM_ptr2number }, + { "GetFullPath", core_GetFullPath }, { "Version", NULL }, diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index 49078c9563..8b303f0188 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -170,6 +170,13 @@ int luaM_totable(lua_State *L) return 1; } +int luaM_ptr2number(lua_State *L) +{ + luaL_checktype(L, 1, LUA_TLIGHTUSERDATA); + lua_pushnumber(L, (intptr_t)lua_touserdata(L, 1)); + return 1; +} + void ObsoleteMethod(lua_State *L, const char *message) { lua_Debug info; diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index 5f4b58a781..efefd020ad 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -132,7 +132,7 @@ int luaM_print(lua_State *L); int luaM_toansi(lua_State *L); int luaM_toucs2(lua_State *L); - +int luaM_ptr2number(lua_State *L); int luaM_totable(lua_State *L); bool luaM_toboolean(lua_State *L, int idx); -- cgit v1.2.3