From 25832dae9df8849e0ed79f6e602b1bdf86475d31 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 20 Mar 2014 14:35:48 +1000 Subject: Remove the module() code again. --- ClientHamr/GuiLua/skang.lua | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'ClientHamr/GuiLua/skang.lua') diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 9b14551..62ea957 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -312,26 +312,3 @@ end -- "_ENV is not supported directly in 5.1, so its use can prevent a module from remaining compatible with 5.1. -- Maybe you can simulate _ENV with setfenv and trapping gets/sets to it via __index/__newindex metamethods, or just avoid _ENV." --[[ This is a Lua version of what module() does. Apparently the _LOADED stuff is needed somehow, even though it's a local? Think that was bogus. - -local _LOADED = package.loaded -function _G.module (modname, ...) - local ns = _LOADED[modname] - if type(ns) ~= "table" then - ns = findtable (_G, modname) - if not ns then - error (string.format ("name conflict for module '%s'", modname)) - end - _LOADED[modname] = ns - end - if not ns._NAME then - ns._NAME = modname - ns._M = ns - ns._PACKAGE = gsub (modname, "[^.]*$", "") - end - setfenv (2, ns) - for i, f in ipairs (arg) do - f (ns) - end -end - -]] -- cgit v1.1