diff --git a/meta/uname.lua b/meta/uname.lua new file mode 100644 index 0000000..0522928 --- /dev/null +++ b/meta/uname.lua @@ -0,0 +1,25 @@ +---@meta uname + +---@class unamelib +local uname = {} + +---@param x integer +---@return integer +---@nodiscard +function uname.numid(x) end + +---@param x integer +---@return integer +---@nodiscard +function uname.plusone(x) end + +---@class uname +---@field sysname string +---@field machine string +---@field release string +---@field version string + +---@return uname +function uname.uname() end + +return uname diff --git a/test_uname.lua b/test_uname.lua new file mode 100644 index 0000000..dec3b36 --- /dev/null +++ b/test_uname.lua @@ -0,0 +1,27 @@ +---@module 'uname' +local uname +uname = require'uname' + +print(uname) + +for k, v in pairs(uname) do + print(k, v) +end + +print("numid", uname.numid(1)) +do + local result, ret = xpcall(uname.numid, debug.traceback, "a", "b") + if not result then + io.stderr:write("error" .. ret .. "\n") + else + print("result: " .. ret) + end +end + +print(type(uname.uname())) +print("uname") +for k, v in pairs(uname.uname()) do + print(k, v) +end +print("OS is " .. uname.uname().sysname) +