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 |