First commit, step 4 completed

This commit is contained in:
bepis
2026-10-15 14:27:00 +11:00
commit 9a30efa170
5378 changed files with 1136719 additions and 0 deletions
@@ -0,0 +1,371 @@
---@meta _
---@diagnostic disable: duplicate-doc-field
---@diagnostic disable: duplicate-doc-alias
--- added: gcinfo
--- edited: xpcall (lua 5.2), getfenv
--- removed: dofile, load, loadfile, module, rawlen, warn
---
---Command-line arguments of Lua Standalone.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-arg"])
---
---@type string[]
arg = {}
---
---Raises an error if the value of its argument v is false (i.e., `nil` or `false`); otherwise, returns all its arguments. In case of error, `message` is the error object; when absent, it defaults to `"assertion failed!"`
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-assert"])
---
---@generic T
---@param v? T
---@param message? any
---@param ... any
---@return T
---@return any ...
function assert(v, message, ...) end
---@alias gcoptions
---|>"collect" # Performs a full garbage-collection cycle.
---| "stop" # Stops automatic execution.
---| "restart" # Restarts automatic execution.
---| "count" # Returns the total memory in Kbytes.
---| "step" # Performs a garbage-collection step.
---| "isrunning" # Returns whether the collector is running.
---| "setpause" # Set `pause`.
---| "setstepmul" # Set `step multiplier`.
---
---This function is a generic interface to the garbage collector. It performs different functions according to its first argument, `opt`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-collectgarbage"])
---
---@param opt? gcoptions
---@param arg? integer
---@return any
function collectgarbage(opt, arg) end
---
---Terminates the last protected function called and returns message as the error object.
---
---Usually, `error` adds some information about the error position at the beginning of the message, if the message is a string.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-error"])
---
---@param message any
---@param level? integer
function error(message, level) end
---
---A global variable (not a function) that holds the global environment (see [§2.2](command:extension.lua.doc?["en-us/51/manual.html/2.2"])). Lua itself does not use this variable; changing its value does not affect any environment, nor vice versa.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-_G"])
---
---@class _G
_G = {}
---Returns the current environment in use by the function. `f` can be a Lua function or a number that specifies the function at that stack level.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-getfenv"]), [Wiki](https://warcraft.wiki.gg/wiki/API_getfenv)
---
---@param f? integer|async fun(...):...
---@return table|_G
---@nodiscard
function getfenv(f) end
---
---If object does not have a metatable, returns nil. Otherwise, if the object's metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-getmetatable"])
---
---@param object any
---@return table metatable
---@nodiscard
function getmetatable(object) end
---
---Returns three values (an iterator function, the table `t`, and `0`) so that the construction
---```lua
--- for i,v in ipairs(t) do body end
---```
---will iterate over the key–value pairs `(1,t[1]), (2,t[2]), ...`, up to the first absent index.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-ipairs"])
---
---@generic T: table, V
---@param t T
---@return fun(table: V[], i?: integer):integer, V
---@return T
---@return integer i
function ipairs(t) end
---@alias loadmode
---| "b" # Only binary chunks.
---| "t" # Only text chunks.
---|>"bt" # Both binary and text.
---Loads a chunk from the given string.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadstring"])
---
---@param text string
---@param chunkname? string
---@return function?
---@return string? error_message
---@nodiscard
function loadstring(text, chunkname) end
---Creates a zero-size "userdata" object, optionally swith a sharable empty metatable.
---
---[Documentation](https://warcraft.wiki.gg/wiki/API_newproxy)
---@param proxy boolean|table|userdata
---@return userdata
---@nodiscard
function newproxy(proxy) end
---
---Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. A call to `next` returns the next index of the table and its associated value. When called with `nil` as its second argument, `next` returns an initial index and its associated value. When called with the last index, or with `nil` in an empty table, `next` returns `nil`. If the second argument is absent, then it is interpreted as `nil`. In particular, you can use `next(t)` to check whether a table is empty.
---
---The order in which the indices are enumerated is not specified, *even for numeric indices*. (To traverse a table in numerical order, use a numerical `for`.)
---
---The behavior of `next` is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may set existing fields to nil.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"])
---
---@generic K, V
---@param tbl table<K, V>
---@param index? K
---@return K?
---@return V?
---@nodiscard
function next(tbl, index) end
---
---If `t` has a metamethod `__pairs`, calls it with t as argument and returns the first three results from the call.
---
---Otherwise, returns three values: the [next](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"]) function, the table `t`, and `nil`, so that the construction
---```lua
--- for k,v in pairs(t) do body end
---```
---will iterate over all key–value pairs of table `t`.
---
---See function [next](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"]) for the caveats of modifying the table during its traversal.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-pairs"])
---
---@generic T: table, K, V
---@param t T
---@return fun(table: table<K, V>, index?: K):K, V
---@return T
function pairs(t) end
---
---Calls the function `f` with the given arguments in *protected mode*. This means that any error inside `f` is not propagated; instead, `pcall` catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, `pcall` also returns all results from the call, after this first result. In case of any error, `pcall` returns `false` plus the error object.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-pcall"])
---
---@param f function
---@param arg1? any
---@param ... any
---@return boolean success
---@return any result
---@return any ...
function pcall(f, arg1, ...) end
---
---Receives any number of arguments and prints their values to `stdout`, converting each argument to a string following the same rules of [tostring](command:extension.lua.doc?["en-us/51/manual.html/pdf-tostring"]).
---The function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use [string.format](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]) and [io.write](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.write"]).
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-print"])
---
---@param ... any
function print(...) end
---
---Checks whether v1 is equal to v2, without invoking the `__eq` metamethod.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawequal"])
---
---@param v1 any
---@param v2 any
---@return boolean
---@nodiscard
function rawequal(v1, v2) end
---
---Gets the real value of `table[index]`, without invoking the `__index` metamethod.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawget"])
---
---@param tbl table
---@param index any
---@return any
---@nodiscard
function rawget(tbl, index) end
---
---Sets the real value of `table[index]` to `value`, without using the `__newindex` metavalue. `table` must be a table, `index` any value different from `nil` and `NaN`, and `value` any Lua value.
---This function returns `table`.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawset"])
---
---@param tbl table
---@param index any
---@param value any
---@return table
function rawset(tbl, index, value) end
---
---If `index` is a number, returns all arguments after argument number `index`; a negative number indexes from the end (`-1` is the last argument). Otherwise, `index` must be the string `"#"`, and `select` returns the total number of extra arguments it received.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-select"])
---
---@param index integer|"#"
---@param ... any
---@return any
---@nodiscard
function select(index, ...) end
---Sets the environment to be used by the given function.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-setfenv"])
---
---@param f (async fun(...):...)|integer
---@param tbl table
---@return function
function setfenv(f, tbl) end
---@class metatable
---@field __mode 'v'|'k'|'kv'|nil
---@field __metatable any|nil
---@field __tostring (fun(t):string)|nil
---@field __gc fun(t)|nil
---@field __add (fun(t1,t2):any)|nil
---@field __sub (fun(t1,t2):any)|nil
---@field __mul (fun(t1,t2):any)|nil
---@field __div (fun(t1,t2):any)|nil
---@field __mod (fun(t1,t2):any)|nil
---@field __pow (fun(t1,t2):any)|nil
---@field __unm (fun(t):any)|nil
---@field __concat (fun(t1,t2):any)|nil
---@field __len (fun(t):integer)|nil
---@field __eq (fun(t1,t2):boolean)|nil
---@field __lt (fun(t1,t2):boolean)|nil
---@field __le (fun(t1,t2):boolean)|nil
---@field __index table|(fun(t,k):any)|nil
---@field __newindex table|fun(t,k,v)|nil
---@field __call (fun(t,...):...)|nil
---
---Sets the metatable for the given table. If `metatable` is `nil`, removes the metatable of the given table. If the original metatable has a `__metatable` field, raises an error.
---
---This function returns `table`.
---
---To change the metatable of other types from Lua code, you must use the debug library ([§6.10](command:extension.lua.doc?["en-us/51/manual.html/6.10"])).
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-setmetatable"])
---
---@param tbl table
---@param metatable? metatable|table
---@return table
function setmetatable(tbl, metatable) end
---
---When called with no `base`, `tonumber` tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then `tonumber` returns this number; otherwise, it returns `fail`.
---
---The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see [§3.1](command:extension.lua.doc?["en-us/51/manual.html/3.1"])). The string may have leading and trailing spaces and a sign.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-tonumber"])
---
---@overload fun(e: string, base: integer):integer
---@param e any
---@return number?
---@nodiscard
function tonumber(e) end
---
---Receives a value of any type and converts it to a string in a human-readable format.
---
---If the metatable of `v` has a `__tostring` field, then `tostring` calls the corresponding value with `v` as argument, and uses the result of the call as its result. Otherwise, if the metatable of `v` has a `__name` field with a string value, `tostring` may use that string in its final result.
---
---For complete control of how numbers are converted, use [string.format](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]).
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-tostring"])
---
---@param v any
---@return string
---@nodiscard
function tostring(v) end
---@alias type
---| "nil"
---| "number"
---| "string"
---| "boolean"
---| "table"
---| "function"
---| "thread"
---| "userdata"
---
---Returns the type of its only argument, coded as a string. The possible results of this function are `"nil"` (a string, not the value `nil`), `"number"`, `"string"`, `"boolean"`, `"table"`, `"function"`, `"thread"`, and `"userdata"`.
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-type"])
---
---@param v any
---@return type type
---@nodiscard
function type(v) end
---
---A global variable (not a function) that holds a string containing the running Lua version.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-_VERSION"])
---
_VERSION = "Lua 5.1"
---
---Calls function `f` with the given arguments in protected mode with a new message handler.
---
---[View documents](command:extension.lua.doc?["en-us/52/manual.html/pdf-xpcall"]), [Wiki](https://warcraft.wiki.gg/wiki/API_xpcall)
---
---@param f async fun(...):...
---@param msgh function
---@param arg1? any
---@param ... any
---@return boolean success
---@return any result
---@return any ...
function xpcall(f, msgh, arg1, ...) end
---Returns the elements from the given `list`. This function is equivalent to
---```lua
--- return list[i], list[i+1], ···, list[j]
---```
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-unpack"]), [Wiki](https://warcraft.wiki.gg/wiki/API_unpack)
---
---@generic T
---@param list T[]
---@param i? integer
---@param j? integer
---@return T ...
---@nodiscard
function unpack(list, i, j) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_gcinfo)
---@return number memoryInUse
---@nodiscard
function gcinfo() end
@@ -0,0 +1,57 @@
---@meta bit_wow
bit = {}
--- Returns the one's complement of `a`
---@param a number
---@return number
---@nodiscard
function bit.bnot(a) end
--- Returns the bitwise "AND" of the values
---@param a1 number
---@param ... number
---@return number
---@nodiscard
function bit.band(a1, ...) end
--- Returns the bitwise "OR" of the values
---@param a1 number
---@param ... number
---@return number
---@nodiscard
function bit.bor(a1, ...) end
--- Returns the bitwise "exclusive OR" of the values
---@param a1 number
---@param ... number
---@return number
---@nodiscard
function bit.bxor(a1, ...) end
--- Returns `a` logical shifted left by `n` bits
---@param a number
---@param n number
---@return number
---@nodiscard
function bit.lshift(a, n) end
--- Returns `a` logical shifted right by `n` bits
---@param a number
---@param n number
---@return number
---@nodiscard
function bit.rshift(a, n) end
--- Returns `a` arithmetically shifted right by `n` bits
---@param a number
---@param n number
---@return number
---@nodiscard
function bit.arshift(a, n) end
--- Returns the signed value of `a` modulo `n`
---@param a number
---@param n number
---@return number
---@nodiscard
function bit.mod(a, n) end
@@ -0,0 +1,64 @@
---@meta _
---@diagnostic disable: deprecated
-------------------------------------------------------------------
-- Table library
local tab = table
foreach = tab.foreach
foreachi = tab.foreachi
getn = tab.getn
tinsert = tab.insert
tremove = tab.remove
sort = tab.sort
wipe = tab.wipe
-------------------------------------------------------------------
-- math library
local math = math
abs = math.abs
acos = function (x) return math.deg(math.acos(x)) end
asin = function (x) return math.deg(math.asin(x)) end
atan = function (x) return math.deg(math.atan(x)) end
atan2 = function (x,y) return math.deg(math.atan2(x,y)) end
ceil = math.ceil
cos = function (x) return math.cos(math.rad(x)) end
deg = math.deg
exp = math.exp
floor = math.floor
frexp = math.frexp
ldexp = math.ldexp
log = math.log
log10 = math.log10
max = math.max
min = math.min
mod = math.fmod
PI = math.pi
--pow = math.pow
rad = math.rad
random = math.random
sin = function (x) return math.sin(math.rad(x)) end
sqrt = math.sqrt
tan = function (x) return math.tan(math.rad(x)) end
-------------------------------------------------------------------
-- string library
local str = string
strbyte = str.byte
strchar = str.char
strfind = str.find
format = str.format
gmatch = str.gmatch
gsub = str.gsub
strlen = str.len
strlower = str.lower
strmatch = str.match
strrep = str.rep
strrev = str.reverse
strsub = str.sub
strupper = str.upper
-------------------------------------------------------------------
-- Add custom string functions to the string table
strtrim = str.trim
strsplit = str.split
strjoin = str.join
strconcat = str.concat
@@ -0,0 +1,312 @@
---@meta math_wow
---@diagnostic disable: duplicate-doc-field
--- added: fastrandom
--- removed: math.randomseed, math.tointeger, math.type, math.ult
---
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math"])
---
---@class mathlib
---
---A value larger than any other numeric value.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.huge"])
---
---@field huge number
---
---The value of *π*.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.pi"])
---
---@field pi number
math = {}
---
---Returns the absolute value of `x`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.abs"])
---
---@generic Number: number
---@param x Number
---@return Number
---@nodiscard
function math.abs(x) end
---
---Returns the arc cosine of `x` (in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.acos"])
---
---@param x number
---@return number
---@nodiscard
function math.acos(x) end
---
---Returns the arc sine of `x` (in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.asin"])
---
---@param x number
---@return number
---@nodiscard
function math.asin(x) end
---
---Returns the arc tangent of `x` (in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.atan"])
---
---@param y number
---@return number
---@nodiscard
function math.atan(y) end
---Returns the arc tangent of `y/x` (in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.atan2"])
---
---@param y number
---@param x number
---@return number
---@nodiscard
function math.atan2(y, x) end
---
---Returns the smallest integral value larger than or equal to `x`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.ceil"])
---
---@param x number
---@return integer
---@nodiscard
function math.ceil(x) end
---
---Returns the cosine of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.cos"])
---
---@param x number
---@return number
---@nodiscard
function math.cos(x) end
---Returns the hyperbolic cosine of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.cosh"])
---
---@param x number
---@return number
---@nodiscard
function math.cosh(x) end
---
---Converts the angle `x` from radians to degrees.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.deg"])
---
---@param x number
---@return number
---@nodiscard
function math.deg(x) end
---
---Returns the value `e^x` (where `e` is the base of natural logarithms).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.exp"])
---
---@param x number
---@return number
---@nodiscard
function math.exp(x) end
---
---Returns the largest integral value smaller than or equal to `x`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.floor"])
---
---@param x number
---@return integer
---@nodiscard
function math.floor(x) end
---
---Returns the remainder of the division of `x` by `y` that rounds the quotient towards zero.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.fmod"])
---
---@param x number
---@param y number
---@return number
---@nodiscard
function math.fmod(x, y) end
---Decompose `x` into tails and exponents. Returns `m` and `e` such that `x = m * (2 ^ e)`, `e` is an integer and the absolute value of `m` is in the range [0.5, 1) (or zero when `x` is zero).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.frexp"])
---
---@param x number
---@return number m
---@return number e
---@nodiscard
function math.frexp(x) end
---Returns `m * (2 ^ e)` .
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.ldexp"])
---
---@param m number
---@param e number
---@return number
---@nodiscard
function math.ldexp(m, e) end
---
---Returns the natural logarithm of `x` .
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.log"])
---
---@param x number
---@return number
---@nodiscard
function math.log(x) end
---Returns the base-10 logarithm of x.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.log10"])
---
---@param x number
---@return number
---@nodiscard
function math.log10(x) end
---
---Returns the argument with the maximum value, according to the Lua operator `<`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.max"])
---
---@generic Number: number
---@param x Number
---@param ... Number
---@return Number
---@nodiscard
function math.max(x, ...) end
---
---Returns the argument with the minimum value, according to the Lua operator `<`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.min"])
---
---@generic Number: number
---@param x Number
---@param ... Number
---@return Number
---@nodiscard
function math.min(x, ...) end
---
---Returns the integral part of `x` and the fractional part of `x`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.modf"])
---
---@param x number
---@return integer
---@return number
---@nodiscard
function math.modf(x) end
---Returns `x ^ y` .
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.pow"])
---
---@param x number
---@param y number
---@return number
---@nodiscard
function math.pow(x, y) end
---
---Converts the angle `x` from degrees to radians.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.rad"])
---
---@param x number
---@return number
---@nodiscard
function math.rad(x) end
---
---* `math.random()`: Returns a float in the range [0,1).
---* `math.random(n)`: Returns a integer in the range [1, n].
---* `math.random(m, n)`: Returns a integer in the range [m, n].
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.random"])
---
---@overload fun():number
---@overload fun(m: integer):integer
---@param m integer
---@param n integer
---@return integer
---@nodiscard
function math.random(m, n) end
---
---Returns the sine of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.sin"])
---
---@param x number
---@return number
---@nodiscard
function math.sin(x) end
---Returns the hyperbolic sine of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.sinh"])
---
---@param x number
---@return number
---@nodiscard
function math.sinh(x) end
---
---Returns the square root of `x`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.sqrt"])
---
---@param x number
---@return number
---@nodiscard
function math.sqrt(x) end
---
---Returns the tangent of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.tan"])
---
---@param x number
---@return number
---@nodiscard
function math.tan(x) end
---Returns the hyperbolic tangent of `x` (assumed to be in radians).
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.tanh"])
---
---@param x number
---@return number
---@nodiscard
function math.tanh(x) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_fastrandom)
---@param lower? number
---@param upper? number
---@return number
---@nodiscard
function fastrandom(lower, upper) end
return math
@@ -0,0 +1,148 @@
---@meta os_wow
---@diagnostic disable: duplicate-doc-field
--- removed: os.clock, os.execute, os.exit, os.getenv, os.remove, os.rename, os.setlocale, os.tmpname
--- no namespace: os.date, os.difftime, os.time
---@class osdate
---
---four digits
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.year"])
---
---@field year integer|string
---
---1-12
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.month"])
---
---@field month integer|string
---
---1-31
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.day"])
---
---@field day integer|string
---
---0-23
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.hour"])
---
---@field hour integer|string
---
---0-59
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.min"])
---
---@field min integer|string
---
---0-61
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.sec"])
---
---@field sec integer|string
---
---weekday, 1–7, Sunday is 1
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.wday"])
---
---@field wday integer|string
---
---day of the year, 1–366
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.yday"])
---
---@field yday integer|string
---
---daylight saving flag, a boolean
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.isdst"])
---
---@field isdst boolean
---
---Returns a string or a table containing date and time, formatted according to the given string `format`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.date"]), [Wiki](https://warcraft.wiki.gg/wiki/API_date)
---
---@param format? string
---@param time? integer
---@return string|osdate
---@nodiscard
function date(format, time) end
---
---Returns the difference, in seconds, from time `t1` to time `t2`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.difftime"]), [Wiki](https://warcraft.wiki.gg/wiki/API_difftime)
---
---@param t2 integer
---@param t1 integer
---@return integer
---@nodiscard
function difftime(t2, t1) end
---@class osdateparam
---
---four digits
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.year"])
---
---@field year integer|string
---
---1-12
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.month"])
---
---@field month integer|string
---
---1-31
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.day"])
---
---@field day integer|string
---
---0-23
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.hour"])
---
---@field hour (integer|string)?
---
---0-59
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.min"])
---
---@field min (integer|string)?
---
---0-61
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.sec"])
---
---@field sec (integer|string)?
---
---weekday, 1–7, Sunday is 1
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.wday"])
---
---@field wday (integer|string)?
---
---day of the year, 1–366
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.yday"])
---
---@field yday (integer|string)?
---
---daylight saving flag, a boolean
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.isdst"])
---
---@field isdst boolean?
---
---Returns the current time when called without arguments, or a time representing the local date and time specified by the given table.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.time"]), [Wiki](https://warcraft.wiki.gg/wiki/API_time)
---
---@param date? osdateparam
---@return integer
---@nodiscard
function time(date) end
@@ -0,0 +1,242 @@
---@meta string_wow
--- added: string.join, string.rtgsub, string.split, strsplittable, string.trim
--- added: strcmputf8i, strlenutf8, strconcat, tostringall
--- removed: string.dump, string.pack, string.packsize, string.unpack
--- obsolete-removed: string.gfind -> renamed to string.gmatch
--- string.rtgsub is from RestrictedTable_rtgsub
---
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string"])
---
---@class stringlib
string = {}
---
---Returns the internal numeric codes of the characters `s[i], s[i+1], ..., s[j]`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.byte"])
---
---@param s string|number
---@param i? integer
---@param j? integer
---@return integer ...
---@nodiscard
function string.byte(s, i, j) end
---
---Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.char"])
---
---@param byte integer
---@param ... integer
---@return string
---@nodiscard
function string.char(byte, ...) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_string.concat)
---@param ... string
---@return string
---@nodiscard
function string.concat(...) end
---
---Looks for the first match of `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) in the string.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.find"])
---
---@param s string|number
---@param pattern string|number
---@param init? integer
---@param plain? boolean
---@return integer|nil start
---@return integer|nil end
---@return any|nil ... captured
---@nodiscard
function string.find(s, pattern, init, plain) end
---
---Returns a formatted version of its variable number of arguments following the description given in its first argument.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"])
---
---@param s string|number
---@param ... any
---@return string
---@nodiscard
function string.format(s, ...) end
---
---Returns an iterator function that, each time it is called, returns the next captures from `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) over the string s.
---
---As an example, the following loop will iterate over all the words from string s, printing one per line:
---```lua
--- s =
---"hello world from Lua"
--- for w in string.gmatch(s, "%a+") do
--- print(w)
--- end
---```
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.gmatch"])
---
---@param s string|number
---@param pattern string|number
---@return fun():string, ...
---@nodiscard
function string.gmatch(s, pattern) end
---
---Returns a copy of s in which all (or the first `n`, if given) occurrences of the `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) have been replaced by a replacement string specified by `repl`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.gsub"])
---
---@param s string|number
---@param pattern string|number
---@param repl string|number|table|function
---@param n? integer
---@return string
---@return integer count
---@nodiscard
function string.gsub(s, pattern, repl, n) end
---
---Returns its length.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.len"])
---
---@param s string|number
---@return integer
---@nodiscard
function string.len(s) end
---
---Returns a copy of this string with all uppercase letters changed to lowercase.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.lower"])
---
---@param s string|number
---@return string
---@nodiscard
function string.lower(s) end
---
---Looks for the first match of `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) in the string.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.match"])
---
---@param s string|number
---@param pattern string|number
---@param init? integer
---@return any ...
---@nodiscard
function string.match(s, pattern, init) end
---
---Returns a string that is the concatenation of `n` copies of the string `s` .
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.rep"])
---
---@param s string|number
---@param n integer
---@return string
---@nodiscard
function string.rep(s, n) end
---
---Returns a string that is the string `s` reversed.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.reverse"])
---
---@param s string|number
---@return string
---@nodiscard
function string.reverse(s) end
---
---Returns the substring of the string that starts at `i` and continues until `j`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.sub"])
---
---@param s string|number
---@param i integer
---@param j? integer
---@return string
---@nodiscard
function string.sub(s, i, j) end
---
---Returns a copy of this string with all lowercase letters changed to uppercase.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.upper"])
---
---@param s string|number
---@return string
---@nodiscard
function string.upper(s) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strjoin)
---@param delim string|number
---@param ... string|number
---@return string
---@nodiscard
function string.join(delim, ...) end
---string.gsub but for restricted tables
---
---[Documentation](https://warcraft.wiki.gg/wiki/API_string.rtgsub)
---@param s string|number
---@param pattern string|number
---@param repl string|number|table|function
---@param n? integer
---@return string
---@return integer count
---@nodiscard
function string.rtgsub(s, pattern, repl, n) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strsplit)
---@param delimiter string
---@param str string
---@param pieces? number
---@return string ...
---@nodiscard
function string.split(delimiter, str, pieces) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strsplittable)
---@param delimiter string
---@param str string
---@param pieces? number
---@return string[] chunks
---@nodiscard
function strsplittable(delimiter, str, pieces) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strtrim)
---@param str string
---@param chars? string
---@return string
---@nodiscard
function string.trim(str, chars) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strcmputf8i)
---@param str1 string
---@param str2 string
---@return number result <= -1: smaller, 0: equal, >= 1: larger
---@nodiscard
function strcmputf8i(str1, str2) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_strlenutf8)
---@param str string
---@return number
---@nodiscard
function strlenutf8(str) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_tostringall)
---@param ... any
---@return string ...
---@nodiscard
function tostringall(...) end
return string
@@ -0,0 +1,131 @@
---@meta table_wow
--- added: table.removemulti, table.wipe
--- removed: table.move, table.pack, table.unpack
--- obsolete-removed: table.setn
--- unpack is in basic.lua
---
---
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table"])
---
---@class tablelib
table = {}
---
---Given a list where all elements are strings or numbers, returns the string `list[i]..sep..list[i+1] ··· sep..list[j]`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.concat"])
---
---@param list table
---@param sep? string
---@param i? integer
---@param j? integer
---@return string
---@nodiscard
function table.concat(list, sep, i, j) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_table.count)
---@param tbl table
---@return number numTableNodes Total number of elements within the table
---@return number numArrayNodes Total number of elements within the table that had integral keys in the range [1..numTableNodes]"
---@return number maxArrayIndex Largest integral key within the table, or zero if no such keys were found"
function table.count(tbl) end
---[Documentation](https://warcraft.wiki.gg/wiki/API_table.create)
---@param arraySizeHint number
---@param nodeSizeHint? number
---@return table
---@nodiscard
function table.create(arraySizeHint, nodeSizeHint) end
---
---Inserts element `value` at position `pos` in `list`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.insert"])
---
---@overload fun(list: table, value: any)
---@param list table
---@param pos integer
---@param value any
function table.insert(list, pos, value) end
---Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.maxn"])
---
---@param tbl table
---@return integer
---@nodiscard
function table.maxn(tbl) end
---
---Removes from `list` the element at position `pos`, returning the value of the removed element.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.remove"])
---
---@param list table
---@param pos? integer
---@return any
function table.remove(list, pos) end
---
---Sorts list elements in a given order, *in-place*, from `list[1]` to `list[#list]`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.sort"])
---
---@generic T
---@param list T[]
---@param comp? fun(a: T, b: T):boolean
function table.sort(list, comp) end
---Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.foreach"])
---
---@generic T
---@param list any
---@param callback fun(key: string, value: any):T|nil
---@return T|nil
---@deprecated
function table.foreach(list, callback) end
---Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.foreachi"])
---
---@generic T
---@param list any
---@param callback fun(key: string, value: any):T|nil
---@return T|nil
---@deprecated
function table.foreachi(list, callback) end
---Returns the number of elements in the table. This function is equivalent to `#list`.
---
---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.getn"]), [Wiki](https://warcraft.wiki.gg/wiki/API_table.getn)
---
---@generic T
---@param list T[]
---@return integer
---@nodiscard
---@deprecated
function table.getn(list) end
---Removes `count` elements from a table starting at index `pos`.
---
---[Wiki](https://warcraft.wiki.gg/wiki/API_table.removemulti)
---
---@param list table
---@param pos? integer
---@return any
function table.removemulti(list, pos, count) end
---Wipes a table of all contents.
---
---[Wiki](https://warcraft.wiki.gg/wiki/API_wipe)
---@param tbl table
---@return table
function table.wipe(tbl) end
return table