diff --git a/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua b/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua index cf9204bdd51..3f88155ccf3 100644 --- a/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua +++ b/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua @@ -44,4 +44,7 @@ function main(luafile, bcfile, opt) raise(errors) end end -return main + +if xmake._LUAJIT then + return main +end diff --git a/xmake/core/sandbox/modules/import/lib/luajit/bit.lua b/xmake/core/sandbox/modules/import/lib/luajit/bit.lua index d4895c27c0b..5647557a71e 100644 --- a/xmake/core/sandbox/modules/import/lib/luajit/bit.lua +++ b/xmake/core/sandbox/modules/import/lib/luajit/bit.lua @@ -18,5 +18,6 @@ -- @file bit.lua -- --- return module -return require("bit") +if xmake._LUAJIT then + return require("bit") +end diff --git a/xmake/core/sandbox/modules/import/lib/luajit/ffi.lua b/xmake/core/sandbox/modules/import/lib/luajit/ffi.lua index 3dfdea230c6..7e855d8a66d 100644 --- a/xmake/core/sandbox/modules/import/lib/luajit/ffi.lua +++ b/xmake/core/sandbox/modules/import/lib/luajit/ffi.lua @@ -18,5 +18,6 @@ -- @file ffi.lua -- --- return module -return require("ffi") +if xmake._LUAJIT then + return require("ffi") +end diff --git a/xmake/core/sandbox/modules/import/lib/luajit/jit.lua b/xmake/core/sandbox/modules/import/lib/luajit/jit.lua index cc049a44adf..652d9368e33 100644 --- a/xmake/core/sandbox/modules/import/lib/luajit/jit.lua +++ b/xmake/core/sandbox/modules/import/lib/luajit/jit.lua @@ -18,5 +18,6 @@ -- @file jit.lua -- --- return module -return require("jit") +if xmake._LUAJIT then + return require("jit") +end diff --git a/xmake/plugins/show/lists/apis.lua b/xmake/plugins/show/lists/apis.lua index 1a70263e600..7e481b2064c 100644 --- a/xmake/plugins/show/lists/apis.lua +++ b/xmake/plugins/show/lists/apis.lua @@ -284,12 +284,14 @@ function script_extension_module_apis() end modulename = modulename:gsub("/", "."):gsub("%.lua", "") local instance = import(modulename, {try = true, anonymous = true}) - if _is_callable(instance) then - table.insert(result, modulename) - elseif type(instance) == "table" then - for k, v in pairs(instance) do - if not k:startswith("_") and type(v) == "function" then - table.insert(result, modulename .. "." .. k) + if instance then + if _is_callable(instance) then + table.insert(result, modulename) + elseif type(instance) == "table" then + for k, v in pairs(instance) do + if not k:startswith("_") and type(v) == "function" then + table.insert(result, modulename .. "." .. k) + end end end end