summaryrefslogtreecommitdiff
path: root/xmake/core/base/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-30 23:51:59 +0800
committerruki <[email protected]>2026-03-30 23:51:59 +0800
commit701d59c83a64bf5aa73f2bc386a0cdba087349c4 (patch)
tree85de317c9904b4aa9e818cbef5615ed2cfad28be /xmake/core/base/xmake.lua
parente23dc968df5fa84e24e98a7fff903e40a12d6624 (diff)
update more comments
Diffstat (limited to 'xmake/core/base/xmake.lua')
-rw-r--r--xmake/core/base/xmake.lua48
1 files changed, 39 insertions, 9 deletions
diff --git a/xmake/core/base/xmake.lua b/xmake/core/base/xmake.lua
index d25e60147..53971de8c 100644
--- a/xmake/core/base/xmake.lua
+++ b/xmake/core/base/xmake.lua
@@ -24,12 +24,18 @@ local xmake = xmake or {}
-- load modules
local semver = require("base/semver")
--- get name
+-- get xmake program name
+--
+-- @return the name string, e.g. "xmake"
+--
function xmake.name()
return xmake._NAME or "xmake"
end
--- get xmake version, e.g. v2.5.8+dev.d4cff6e11
+-- get xmake version
+--
+-- @return the semver version object, e.g. xmake.version():ge("3.0.0")
+--
function xmake.version()
if xmake._VERSION_CACHE == nil then
xmake._VERSION_CACHE = semver.new(xmake._VERSION) or false
@@ -38,41 +44,65 @@ function xmake.version()
end
-- get the xmake binary architecture
+--
+-- @return the architecture string, e.g. "x86_64", "arm64"
+--
function xmake.arch()
return xmake._XMAKE_ARCH
end
--- get the git branch of xmake version, e.g. build: {"dev", "d4cff6e11"}
+-- get the git branch and commit of xmake version
+--
+-- @return the branch string and commit hash
+--
function xmake.branch()
return xmake.version():build()[1]
end
--- get the program directory
+-- get the xmake program scripts directory
+--
+-- @return the program directory path
+--
function xmake.programdir()
return xmake._PROGRAM_DIR
end
--- get the program file
+-- get the xmake program binary file path
+--
+-- @return the program file path
+--
function xmake.programfile()
return xmake._PROGRAM_FILE
end
--- use luajit?
+-- is using LuaJIT runtime?
+--
+-- @return true if LuaJIT
+--
function xmake.luajit()
return xmake._LUAJIT
end
--- is embed?
+-- is embedded via libxmake (xmake.cli)?
+--
+-- @return true if embedded
+--
function xmake.is_embed()
return xmake._EMBED or false
end
--- in main thread?
+-- is running in the main thread?
+--
+-- @return true if in main thread
+--
function xmake.in_main_thread()
return xmake._THREAD_CALLBACK == nil
end
--- get command arguments
+-- get the command line arguments
+--
+-- @return the arguments array
+--
function xmake.argv()
return xmake._ARGV
end