add lua sample and definition file in lua
This commit is contained in:
parent
818a9f4254
commit
1c096cdd3c
2 changed files with 52 additions and 0 deletions
25
meta/uname.lua
Normal file
25
meta/uname.lua
Normal file
|
@ -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
|
27
test_uname.lua
Normal file
27
test_uname.lua
Normal file
|
@ -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)
|
||||
|
Loading…
Reference in a new issue