forked from enlightenment/efl
elua: support for passing data to modules via require
This commit is contained in:
parent
ba35fe91d1
commit
5d5185f900
|
@ -86,12 +86,12 @@ local find_loader = function(modname, env)
|
||||||
return nil, table.concat(err)
|
return nil, table.concat(err)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.require = function(modname)
|
M.require = function(modname, ...)
|
||||||
local v = loaded[modname]
|
local v = loaded[modname]
|
||||||
if v ~= nil then return v end
|
if v ~= nil then return v end
|
||||||
local loader, err = find_loader(modname)
|
local loader, err = find_loader(modname)
|
||||||
if not loader then error(err, 2) end
|
if not loader then error(err, 2) end
|
||||||
local ret = loader(modname)
|
local ret = loader(modname, ...)
|
||||||
if ret ~= nil then
|
if ret ~= nil then
|
||||||
loaded[modname] = ret
|
loaded[modname] = ret
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -558,7 +558,7 @@ local cutil = require("cutil")
|
||||||
local util = require("util")
|
local util = require("util")
|
||||||
local eo = require("eo")
|
local eo = require("eo")
|
||||||
|
|
||||||
local M = %s
|
local M = ...
|
||||||
|
|
||||||
local __lib
|
local __lib
|
||||||
|
|
||||||
|
@ -572,8 +572,7 @@ end
|
||||||
|
|
||||||
cutil.init_module(init, shutdown)
|
cutil.init_module(init, shutdown)
|
||||||
|
|
||||||
]]):format(self.fname, self.klass:full_name_get(), modn, self.libname,
|
]]):format(self.fname, self.klass:full_name_get(), self.libname, self.libname))
|
||||||
self.libname))
|
|
||||||
|
|
||||||
self:gen_children(s)
|
self:gen_children(s)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue