local loadfile = ... local package = {} local loaded = { ["_G"] = _G, ["bit32"] = bit32, ["coroutine"] = coroutine, ["math"] = math, ["os"] = os, ["package"] = package, ["string"] = string, ["table"] = table, } local pkg_path = "/lib/?.lua" package.loaded = loaded function package.search(file,path) for path in path:gmatch("[^;]+") do local possible = path:gsub("%?", file) local s, _ = pcall(loadfile, possible) if s then return possible end end return false end function require(module) if package.loaded[module] then return package.loaded[module] else local path = package.search(module,pkg_path) assert(path, "module not found") local mod = loadfile(path)() package.loaded[module] = mod return mod end end return package