Let modules set/write globals

Wed, 01 Oct 2008 01:18:19 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 01 Oct 2008 01:18:19 +0100
changeset 33
091f91a1f67a
parent 32
a4de5ab077ab
child 34
fd693ef5d978

Let modules set/write globals

main.lua file | annotate | diff | comparison | revisions
--- a/main.lua	Tue Sep 30 21:35:39 2008 +0100
+++ b/main.lua	Wed Oct 01 01:18:19 2008 +0100
@@ -162,9 +162,10 @@
 	sessions[conn].disconnect(err);
 end
 
+modulemanager.loadall();
+
 setmetatable(_G, { __index = function (t, k) print("WARNING: ATTEMPT TO READ A NIL GLOBAL!!!", k); error("Attempt to read a non-existent global. Naughty boy.", 2); end, __newindex = function (t, k, v) print("ATTEMPT TO SET A GLOBAL!!!!", tostring(k).." = "..tostring(v)); error("Attempt to set a global. Naughty boy.", 2); end }) --]][][[]][];
 
-modulemanager.loadall();
 
 local protected_handler = function (conn, data, err) local success, ret = pcall(handler, conn, data, err); if not success then print("ERROR on "..tostring(conn)..": "..ret); conn:close(); end end;
 local protected_disconnect = function (conn, err) local success, ret = pcall(disconnect, conn, err); if not success then print("ERROR on "..tostring(conn).." disconnect: "..ret); conn:close(); end end;

mercurial