summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/MirLua/src/mlua.cpp12
-rw-r--r--plugins/MirLua/src/mlua_metatable.h3
-rw-r--r--plugins/MirLua/src/mlua_script.cpp10
3 files changed, 14 insertions, 11 deletions
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp
index 1dc4ef440d..8fd617fce7 100644
--- a/plugins/MirLua/src/mlua.cpp
+++ b/plugins/MirLua/src/mlua.cpp
@@ -49,14 +49,10 @@ void CMLua::Load()
SetPaths();
- lua_pushcclosure(L, luaM_print, 0);
- lua_setglobal(L, "print");
- lua_pushcclosure(L, luaM_toansi, 0);
- lua_setglobal(L,"a");
- lua_pushcclosure(L, luaM_toucs2, 0);
- lua_setglobal(L, "u");
- lua_pushcclosure(L, luaM_totable, 0);
- lua_setglobal(L, "totable");
+ lua_register(L, "print", luaM_print);
+ lua_register(L, "a", luaM_toansi);
+ lua_register(L, "u", luaM_toucs2);
+ lua_register(L, "totable", luaM_totable);
lua_atpanic(L, luaM_atpanic);
diff --git a/plugins/MirLua/src/mlua_metatable.h b/plugins/MirLua/src/mlua_metatable.h
index ec5ee58451..bef297905e 100644
--- a/plugins/MirLua/src/mlua_metatable.h
+++ b/plugins/MirLua/src/mlua_metatable.h
@@ -135,8 +135,7 @@ public:
{
MT::name = tname;
- lua_pushcfunction(L, lua__new);
- lua_setglobal(L, MT::name);
+ lua_register(L, MT::name, lua__new);
luaL_newmetatable(L, MT::name);
lua_pushcfunction(L, lua__new);
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp
index 3023d8c71e..e1adc52ea3 100644
--- a/plugins/MirLua/src/mlua_script.cpp
+++ b/plugins/MirLua/src/mlua_script.cpp
@@ -18,7 +18,8 @@ CMLuaScript::CMLuaScript(lua_State *L, const TCHAR *path)
CMLuaScript::~CMLuaScript()
{
- mir_free(this->moduleName);
+ mir_free(moduleName);
+ mir_free(filePath);
}
const char* CMLuaScript::GetModuleName() const
@@ -49,6 +50,13 @@ bool CMLuaScript::Load()
return false;
}
+ if (false) // under construction
+ {
+ // setting other enviroment to script
+ lua_newtable(L);
+ lua_setupvalue(L, -2, 1);
+ }
+
if (luaM_pcall(L, 0, 1))
return false;