prosody

changeset 2826
d8e83625ad58
parent 2825
914d7afb8212
child 2827
b9df83793d84
equal deleted inserted replaced
2825:914d7afb8212 2826:d8e83625ad58
284 end 284 end
285 285
286 function init_global_protection() 286 function init_global_protection()
287 -- Catch global accesses 287 -- Catch global accesses
288 local locked_globals_mt = { 288 local locked_globals_mt = {
289 __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end; 289 __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..k.."'", 2)); end;
290 __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end; 290 __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end;
291 }; 291 };
292 292
293 function prosody.unlock_globals() 293 function prosody.unlock_globals()
294 setmetatable(_G, nil); 294 setmetatable(_G, nil);

mercurial