summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/template/file.lua8
-rw-r--r--meta/template/io.lua70
-rw-r--r--meta/template/math.lua149
-rw-r--r--meta/template/os.lua60
-rw-r--r--meta/template/package.lua25
-rw-r--r--meta/template/string.lua0
6 files changed, 309 insertions, 3 deletions
diff --git a/meta/template/file.lua b/meta/template/file.lua
index 8dd97cbc..f24c0a38 100644
--- a/meta/template/file.lua
+++ b/meta/template/file.lua
@@ -7,9 +7,11 @@ local file = {}
---|>'"l"'
---| '"L"'
----@return boolean suc?
----@return '"exit"'|'"signal"'?
----@return integer code?
+---@alias exitcode | '"exit"'|'"signal"'
+
+---@return boolean suc?
+---@return exitcode exitcode?
+---@return integer code?
function file:close() end
function file:flush() end
diff --git a/meta/template/io.lua b/meta/template/io.lua
new file mode 100644
index 00000000..c0d1689c
--- /dev/null
+++ b/meta/template/io.lua
@@ -0,0 +1,70 @@
+---@class io
+---@field stdin file
+---@field stdout file
+---@field stderr file
+io = {}
+
+---@alias openmode
+---|>'"r"'
+---| '"w"'
+---| '"a"'
+---| '"r+"'
+---| '"w+"'
+---| '"a+"'
+---| '"rb"'
+---| '"wb"'
+---| '"ab"'
+---| '"r+b"'
+---| '"w+b"'
+---| '"a+b"'
+
+---@param file file?
+---@return boolean suc?
+---@return exitcode exitcode?
+---@return integer code?
+function io.close(file) end
+
+function io.flush() end
+
+---@overload fun():file
+---@param file string|file
+function io.input(file) end
+
+---@param filename string?
+---@vararg readmode
+---@return fun():string|number
+function io.lines(filename, ...) end
+
+---@overload fun():file
+---@param file string|file
+function io.output(file) end
+
+---@alias popenmode
+---| '"r"'
+---| '"w"'
+
+---@param prog string
+---@param mode popenmode?
+---@return file?
+---@return string errmsg?
+function io.popen(prog, mode) end
+
+---@vararg readmode
+---@return string|number
+---@return ...
+function io.read(...) end
+
+---@return file
+function io.tmpfile() end
+
+---@alias filetype
+---| '"file"'
+---| '"closed file"'
+---| 'nil'
+---@param file file
+---@return filetype
+function io.type(file) end
+
+---@return file
+---@return string errmsg?
+function io.write(...) end
diff --git a/meta/template/math.lua b/meta/template/math.lua
new file mode 100644
index 00000000..31473b25
--- /dev/null
+++ b/meta/template/math.lua
@@ -0,0 +1,149 @@
+---@class math
+---@field huge number
+---@field maxinteger integer
+---@field mininteger integer
+---@field pi number
+math = {}
+
+---@param x number
+---@return number
+function math.abs(x) end
+
+---@param x number
+---@return number
+function math.acos(x) end
+
+---@param x number
+---@return number
+function math.asin(x) end
+
+---@param y number
+---@param x number
+---@return number
+function math.atan(y, x) end
+
+---@param y number
+---@param x number
+---@return number
+
+---@param y any
+---@param x any
+function math.atan2(y, x) end
+
+---@param x number
+---@return integer
+function math.ceil(x) end
+
+---@param x number
+function math.cos(x) end
+
+---@param x number
+---@return number
+function math.cosh(x) end
+
+---@param x number
+---@return number
+function math.deg(x) end
+
+---@param x number
+---@return number
+function math.exp(x) end
+
+---@param x number
+---@return number
+function math.floor(x) end
+
+---@param x number
+---@param y number
+---@return number
+function math.fmod(x, y) end
+
+---@param x number
+---@return number m
+---@return number e
+function math.frexp(x) end
+
+---@param m number
+---@param e number
+---@return number
+function math.ldexp(m, e) end
+
+---@param x number
+---@param base integer?
+---@return number
+function math.log(x, base) end
+
+---@param x number
+---@return number
+function math.log10(x) end
+
+---@param x number
+---@vararg number
+---@return number
+function math.max(x, ...) end
+
+---@param x number
+---@vararg number
+---@return number
+function math.min(x, ...) end
+
+---@param x number
+---@return integer
+---@return number
+function math.modf(x) end
+
+---@param x number
+---@param y number
+---@return number
+function math.pow(x, y) end
+
+---@param x number
+---@return number
+function math.rad(x) end
+
+---@overload fun():number
+---@overload fun(m: integer):integer
+---@param m integer
+---@param n integer
+---@return integer
+function math.random(m, n) end
+
+---@param x integer?
+---@param y integer?
+function math.randomseed(x, y) end
+
+---@param x number
+---@return number
+function math.sin(x) end
+
+---@param x number
+---@return number
+function math.sinh(x) end
+
+---@param x number
+---@return number
+function math.sqrt(x) end
+
+---@param x number
+---@return number
+function math.tan(x) end
+
+---@param x number
+---@return number
+function math.tanh(x) end
+
+---@param x number
+---@return integer?
+function math.tointeger(x) end
+
+---@param x any
+---@return
+---| '"integer"'
+---| '"float"'
+---| 'nil'
+function math.type(x) end
+
+---@param m integer
+---@param n integer
+---@return boolean
+function math.ult(m, n) end
diff --git a/meta/template/os.lua b/meta/template/os.lua
new file mode 100644
index 00000000..d4350721
--- /dev/null
+++ b/meta/template/os.lua
@@ -0,0 +1,60 @@
+---@class os
+os = {}
+
+---@return number
+function os.clock() end
+
+---@param format string?
+---@param time integer?
+---@return string
+function os.date(format, time) end
+
+---@param t2 integer
+---@param t1 integer
+---@return integer
+function os.difftime(t2, t1) end
+
+---@param command string
+---@return boolean suc?
+---@return exitcode exitcode?
+---@return integer code?
+function os.execute(command) end
+
+---@param code boolean|integer?
+---@param close boolean?
+function os.exit(code, close) end
+
+---@param varname string
+---@return string
+function os.getenv(varname) end
+
+---@param filename string
+---@return boolean suc
+---@return string errmsg?
+function os.remove(filename) end
+
+---@param oldname string
+---@param newname string
+---@return boolean suc
+---@return string errmsg?
+function os.rename(oldname, newname) end
+
+---@alias localecategory
+---|>'"all"'
+---| '"collate"'
+---| '"ctype"'
+---| '"monetary"'
+---| '"numeric"'
+---| '"time"'
+
+---@param locale string|nil
+---@param category localecategory?
+---@return string localecategory
+function os.setlocale(locale, category) end
+
+---@param date table?
+---@return integer
+function os.time(date) end
+
+---@return string
+function os.tmpname() end
diff --git a/meta/template/package.lua b/meta/template/package.lua
new file mode 100644
index 00000000..7970e2ca
--- /dev/null
+++ b/meta/template/package.lua
@@ -0,0 +1,25 @@
+---@class package
+---@field conifg string
+---@field cpath string
+---@field loaded table
+---@field loaders table
+---@field path string
+---@field preload table
+---@field searchers table
+package = {}
+
+---@param libname string
+---@param funcname string
+---@return any
+function package.loadlib(libname, funcname) end
+
+---@param name string
+---@param path string
+---@param sep string?
+---@param rep string?
+---@return string|nil filename
+---@return string errmsg?
+function package.searchpath(name, path, sep, rep) end
+
+---@param module table
+function package.seeall(module) end
diff --git a/meta/template/string.lua b/meta/template/string.lua
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/meta/template/string.lua