-
Notifications
You must be signed in to change notification settings - Fork 2
Xlua Custom Loading Module Design
daao edited this page Jul 27, 2017
·
1 revision
requrie(moduleName)
firstly, require is a function
package.loaded
{
_G
{
require = function: 0x003c3990
}
}
pseudo code
function require(moduleName)
if not package.loaded[moduleName] then
local loader = findloader(moduleName)
if loader == nil then
error(" loader == nil ", moduleName)
end
package.loaded[moduleName] = true? notice this why here is true ?
local res = loader(moduleName)
if res ~= nil then
package.loaded[moduleName] = res
end
end
return package.loaded[moduleName]
end
package
{
loaded : table: 0x00332468
loaders : table: 0x00333418
preload : table: 0x00333d88
path : ""
cpath : ""
loadlib : function: 0x00333358
}
use package.loaders
here is debug watch window



