diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-18 13:04:16 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-18 13:04:16 +0000 |
commit | 811d9e210f874330efb182cd701e2f69d35c5210 (patch) | |
tree | 1de21abdcb334585a1eb656637e0e9cfa93cd6f9 /plugins/MirLua/src | |
parent | b465bd352ef3d585ed1b7b906df68396b34c1cc4 (diff) |
MirLua: luserdata -> number convert function
git-svn-id: http://svn.miranda-ng.org/main/trunk@16120 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src')
-rw-r--r-- | plugins/MirLua/src/m_core.cpp | 4 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_utils.cpp | 7 | ||||
-rw-r--r-- | plugins/MirLua/src/stdafx.h | 2 |
3 files changed, 11 insertions, 2 deletions
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);
|