From 01f468ca58ffcb373e67044d1e81fe500b8fcc7b Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 1 Feb 2016 16:28:19 +0000 Subject: MirLua: setting own environment for all script git-svn-id: http://svn.miranda-ng.org/main/trunk@16208 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua_script.cpp | 12 ++++++------ 1 file 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; -- cgit v1.2.3