prosody

changeset 2825
914d7afb8212
parent 2159
b8635ebd7f57
child 2826
d8e83625ad58
equal deleted inserted replaced
2824:f24664b33a1e 2825:914d7afb8212
282 282
283 prosody.start_time = os.time(); 283 prosody.start_time = os.time();
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 = { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end } 288 local locked_globals_mt = {
289 __index = function (t, k) error("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;
291 };
289 292
290 function prosody.unlock_globals() 293 function prosody.unlock_globals()
291 setmetatable(_G, nil); 294 setmetatable(_G, nil);
292 end 295 end
293 296

mercurial