This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
includes("./luafiles.lua") | |
--[[ | |
对于这个target就不需要调用 <module_name>_loadmodules 函数了 | |
见 test.c 中的例子 | |
]] | |
target("lua_require") | |
set_kind("static") | |
add_files("require.lua") | |
add_rules("luafiles", {root_path = ".", module_name = "require"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local realRequire = require; | |
local function get_source_dir() | |
local up = debug.getinfo(3).source:gsub("\\", "/"); | |
if up:sub(1, 1) ~= '@' then | |
return realRequire(name); | |
end | |
up = up:sub(2) |