Skip to content

Commit

Permalink
improve to show apis
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Apr 25, 2024
1 parent 5388efb commit e009e95
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
5 changes: 4 additions & 1 deletion xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ function main(luafile, bcfile, opt)
raise(errors)
end
end
return main

if xmake._LUAJIT then
return main
end
5 changes: 3 additions & 2 deletions xmake/core/sandbox/modules/import/lib/luajit/bit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
-- @file bit.lua
--

-- return module
return require("bit")
if xmake._LUAJIT then
return require("bit")
end
5 changes: 3 additions & 2 deletions xmake/core/sandbox/modules/import/lib/luajit/ffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
-- @file ffi.lua
--

-- return module
return require("ffi")
if xmake._LUAJIT then
return require("ffi")
end
5 changes: 3 additions & 2 deletions xmake/core/sandbox/modules/import/lib/luajit/jit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
-- @file jit.lua
--

-- return module
return require("jit")
if xmake._LUAJIT then
return require("jit")
end
14 changes: 8 additions & 6 deletions xmake/plugins/show/lists/apis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e009e95

Please sign in to comment.