diff options
Diffstat (limited to 'www/cgi-bin')
-rwxr-xr-x | www/cgi-bin/mvc.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index 4ded73d..a36878c 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -93,6 +93,10 @@ new = function (self, modname) c.worker.mvc.on_load = nil end + -- save the new self on the SELF stack + if not SELF then SELF = {} end + SELF[#SELF + 1] = c + return c, worker_loaded, model_loaded end @@ -101,6 +105,16 @@ destroy = function (self) self.worker.mvc.on_unload(self) self.worker.mvc.on_unload = nil end + + -- remove the self from the SELF stack (should be at the end, but just in case) + if SELF then + for i,s in ipairs(SELF) do + if s == self then + table.remove(SELF, i) + break + end + end + end end -- This is a sample front controller/dispatch. |