prosody

changeset 2348
c7e5ed5eca99
parent 2347
f36cd334e7a6
child 2352
a7ef564271a5
equal deleted inserted replaced
2347:f36cd334e7a6 2348:c7e5ed5eca99
294 end 294 end
295 295
296 function init_global_protection() 296 function init_global_protection()
297 -- Catch global accesses 297 -- Catch global accesses
298 local locked_globals_mt = { 298 local locked_globals_mt = {
299 __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..k.."'", 2)); end; 299 __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..tostring(k).."'", 2)); end;
300 __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end; 300 __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end;
301 }; 301 };
302 302
303 function prosody.unlock_globals() 303 function prosody.unlock_globals()
304 setmetatable(_G, nil); 304 setmetatable(_G, nil);

mercurial