summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-26 00:56:34 +0800
committerruki <[email protected]>2024-04-26 00:56:34 +0800
commite009e9523b22cbc1c907c676ea6f25b7efe9ab3b (patch)
tree4a8f1f8a16ad2bc2f353b66ae55841ababfa23c7
parent5388efb7b2ce441eb32c2f3cbfc6027c3f452eda (diff)
improve to show apis
-rw-r--r--xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua5
-rw-r--r--xmake/core/sandbox/modules/import/lib/luajit/bit.lua5
-rw-r--r--xmake/core/sandbox/modules/import/lib/luajit/ffi.lua5
-rw-r--r--xmake/core/sandbox/modules/import/lib/luajit/jit.lua5
-rw-r--r--xmake/plugins/show/lists/apis.lua14
5 files changed, 21 insertions, 13 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua b/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua
index cf9204bdd..3f88155cc 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 d4895c27c..5647557a7 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 3dfdea230..7e855d8a6 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 cc049a44a..652d9368e 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 1a70263e6..7e481b206 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