summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-02-01 16:28:19 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-02-01 16:28:19 +0000
commit01f468ca58ffcb373e67044d1e81fe500b8fcc7b (patch)
tree0f4d474a7c974e64038a36592d4c7f514ab13855 /plugins
parente41da319418808d832e088c4c0b09ffaf8cc144e (diff)
MirLua: setting own environment for all script
git-svn-id: http://svn.miranda-ng.org/main/trunk@16208 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MirLua/src/mlua_script.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp
index e1adc52ea3..573900cd6d 100644
--- a/plugins/MirLua/src/mlua_script.cpp
+++ b/plugins/MirLua/src/mlua_script.cpp
@@ -50,12 +50,12 @@ bool CMLuaScript::Load()
return false;
}
- if (false) // under construction
- {
- // setting other enviroment to script
- lua_newtable(L);
- lua_setupvalue(L, -2, 1);
- }
+ lua_newtable(L);
+ lua_getglobal(L, "_G");
+ lua_setfield(L, -2, "__index");
+ lua_pushvalue(L, -1);
+ lua_setmetatable(L, -2);
+ lua_setupvalue(L, -2, 1);
if (luaM_pcall(L, 0, 1))
return false;