prosody
changeset 943 7f161205121d
parent 942 dae54304967d
child 972 144d0ad17389
equal deleted inserted replaced
942:dae54304967d 943:7f161205121d
   150 		log("error", "Console is enabled, but the console module appears not to be loaded");
   150 		log("error", "Console is enabled, but the console module appears not to be loaded");
   151 	end
   151 	end
   152 end
   152 end
   153 
   153 
   154 -- setup error handling
   154 -- setup error handling
   155 setmetatable(_G, { __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 });
   155 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 }
       
   156 
       
   157 function unlock_globals()
       
   158 	setmetatable(_G, nil);
       
   159 end
       
   160 
       
   161 function lock_globals()
       
   162 	setmetatable(_G, locked_globals_mt);
       
   163 end
       
   164 
       
   165 lock_globals();
   156 
   166 
   157 eventmanager.fire_event("server-started");
   167 eventmanager.fire_event("server-started");
   158 
   168 
   159 local quitting;
   169 local quitting;
   160 while not quitting do
   170 while not quitting do