summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/src')
-rw-r--r--plugins/MirLua/src/m_core.cpp4
-rw-r--r--plugins/MirLua/src/mlua_utils.cpp7
-rw-r--r--plugins/MirLua/src/stdafx.h2
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);