diff --git a/Json_parser/Program.cs b/Json_parser/Program.cs index ed0aa4b..d5df1c6 100644 --- a/Json_parser/Program.cs +++ b/Json_parser/Program.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.RegularExpressions; //using static jsonToLuaParser.Utility; using static jsonToLuaParser.Utility; namespace jsonToLuaParser @@ -33,7 +34,11 @@ static void Main(string[] args) { parse_commands_josn(base_lib_dir, file); } - + + // Copy tsp-lua-5.0 definations + Directory.CreateDirectory(Path.Combine(base_lib_dir, "tsp-lua-5.0")); + var lua_definations_file_path = Path.Combine(base_lib_dir, "tsp-lua-5.0"); + CopyStaticFiles("tsp-lua-5.0", lua_definations_file_path); } static void parse_commands_josn(string base_lib_dir, string json_file_path) @@ -188,7 +193,8 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path) } var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}"; - var nodeTableDetails = $"---@meta\n\n---@class model{file_name}\nmodel{file_name} = {nodeTable_str}" + + var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", ""); + var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" + $"\n--#region node details\n--#endregion"; Directory.CreateDirectory(Path.Combine(base_lib_dir, model)); diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua new file mode 100644 index 0000000..6fe94b8 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua @@ -0,0 +1,386 @@ +---@meta _ + +--- +---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 + +--- +---Opens the named file and executes its content as a Lua chunk. When called without arguments, `dofile` executes the content of the standard input (`stdin`). Returns all values returned by the chunk. In case of errors, `dofile` propagates the error to its caller. (That is, `dofile` does not run in protected mode.) +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-dofile"]) +--- +---@param filename? string +---@return any ... +function dofile(filename) 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"]) +--- +---@param f? integer|async fun(...):... +---@return table +---@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 two results: the number of Kbytes of dynamic memory that Lua is using and the current garbage collector threshold (also in Kbytes). +function gcinfo () 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 + +--- +---Loads a file as a Lua chunk (without running it). If there are no errors, returns the compiled chunk as a function; otherwise, returns nil plus the error message. The environment of the returned function is the global environment. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadfile"]) +--- +---@param filename? string +---@return function? +---@return string? error_message +---@nodiscard +function loadfile(filename) end + +--- +---Links the program with the dynamic C library libname. Inside this library, looks for a function funcname and returns this function as a C function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadfile"]) +--- +---@param libname? string +---@param funcname? string +---@return function? +---@return string? error_message +---@nodiscard +function loadlib(libname, funcname) end +--- +---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 + +--- +---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 table table +---@param index? K +---@return K? +---@return V? +---@nodiscard +function next(table, 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, 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 table table +---@param index any +---@return any +---@nodiscard +function rawget(table, 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 table table +---@param index any +---@param value any +---@return table +function rawset(table, index, value) end + +--- +---Loads the given module, returns any value returned by the given module(`true` when `nil`). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-require"]) +--- +---@param modname string +---@return unknown +function require(modname) 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 table table +---@return function +function setfenv(f, table) 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 table table +---@param metatable? metatable|table +---@return table +function setmetatable(table, 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.0" + + +--- +---Calls function `f` with the given arguments in protected mode with a new message handler. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-xpcall"]) +--- +---@param f function +---@param err function +---@return boolean success +---@return any result +---@return any ... +function xpcall(f, err) 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"]) +--- +---@generic T +---@param list T[] +---@return T ... +---@nodiscard +function unpack(list) end + diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua new file mode 100644 index 0000000..466a096 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua @@ -0,0 +1,16 @@ +---@meta _ + +---@class unknown +---@class any +---@class nil +---@class boolean +---@class true: boolean +---@class false: boolean +---@class number +---@class integer: number +---@class thread +---@class table: { [K]: V } +---@class string: stringlib +---@class userdata +---@class lightuserdata +---@class function diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua new file mode 100644 index 0000000..002777f --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua @@ -0,0 +1,64 @@ +---@meta coroutine + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine"]) +--- +---@class coroutinelib +coroutine = {} + +--- +---Creates a new coroutine, with body `f`. `f` must be a function. Returns this new coroutine, an object with type `"thread"`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.create"]) +--- +---@param f async fun(...):... +---@return thread +---@nodiscard +function coroutine.create(f) end + +--- +---Starts or continues the execution of coroutine `co`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.resume"]) +--- +---@param co thread +---@param val1? any +---@return boolean success +---@return any ... +function coroutine.resume(co, val1, ...) end + +--- +---Returns the status of coroutine `co`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.status"]) +--- +---@param co thread +---@return +---| '"running"' # Is running. +---| '"suspended"' # Is suspended or not started. +---| '"dead"' # Has finished or stopped with an error. +---@nodiscard +function coroutine.status(co) end + +--- +---Creates a new coroutine, with body `f`; `f` must be a function. Returns a function that resumes the coroutine each time it is called. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.wrap"]) +--- +---@param f async fun(...):... +---@return fun(...):... +---@nodiscard +function coroutine.wrap(f) end + +--- +---Suspends the execution of the calling coroutine. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.yield"]) +--- +---@async +---@return any ... +function coroutine.yield(...) end + +return coroutine diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua new file mode 100644 index 0000000..0c20ac1 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua @@ -0,0 +1,149 @@ +---@meta debug + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug"]) +--- +---@class debuglib +debug = {} + +---@class debuginfo +---@field name string +---@field namewhat string +---@field source string +---@field short_src string +---@field linedefined integer +---@field lastlinedefined integer +---@field what string +---@field currentline integer +---@field istailcall boolean +---@field nups integer +---@field func function +---@field activelines table + +--- +---Enters an interactive mode with the user, running each string that the user enters. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.debug"]) +--- +function debug.debug() end + +--- +---Returns the current hook settings of the thread. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.gethook"]) +--- +---@param co? thread +---@return function hook +---@return string mask +---@return integer count +---@nodiscard +function debug.gethook(co) end + +---@alias infowhat string +---|+"n" # `name` and `namewhat` +---|+"S" # `source`, `short_src`, `linedefined`, `lastlinedefined`, and `what` +---|+"l" # `currentline` +---|+"t" # `istailcall` +---|+"u" # `nups` +---|+"f" # `func` +---|+"L" # `activelines` + +--- +---Returns a table with information about a function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getinfo"]) +--- +---@overload fun(f: integer|function, what?: infowhat):debuginfo +---@param thread thread +---@param f integer|async fun(...):... +---@param what? infowhat +---@return debuginfo +---@nodiscard +function debug.getinfo(thread, f, what) end + +--- +---Returns the name and the value of the local variable with index `local` of the function at level `level` of the stack. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getlocal"]) +--- +---@overload fun(level: integer, index: integer):string, any +---@param thread thread +---@param level integer +---@param index integer +---@return string name +---@return any value +---@nodiscard +function debug.getlocal(thread, level, index) end + +--- +---Returns the name and the value of the upvalue with index `up` of the function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getupvalue"]) +--- +---@param f async fun(...):... +---@param up integer +---@return string name +---@return any value +---@nodiscard +function debug.getupvalue(f, up) end + +--- +---Assigns the `value` to the local variable with index `local` of the function at `level` of the stack. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.setlocal"]) +--- +---@overload fun(level: integer, index: integer, value: any):string +---@param thread thread +---@param level integer +---@param index integer +---@param value any +---@return string name +function debug.setlocal(thread, level, index, value) end + +--- +---Assigns the `value` to the upvalue with index `up` of the function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.setupvalue"]) +--- +---@param f async fun(...):... +---@param up integer +---@param value any +---@return string name +function debug.setupvalue(f, up, value) end + + +---@alias hookmask string +---|+"c" # Calls hook when Lua calls a function. +---|+"r" # Calls hook when Lua returns from a function. +---|+"l" # Calls hook when Lua enters a new line of code. + +--- +---Sets the given function as a hook. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.sethook"]) +--- +---@overload fun(hook: (async fun(...):...), mask: hookmask, count?: integer) +---@overload fun(thread: thread):... +---@overload fun(...):... +---@param thread thread +---@param hook async fun(...):... +---@param mask hookmask +---@param count? integer +function debug.sethook(thread, hook, mask, count) end + +--- +---Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.traceback"]) +--- +---@overload fun(message?: any, level?: integer): string +---@param thread thread +---@param message? any +---@param level? integer +---@return string message +---@nodiscard +function debug.traceback(thread, message, level) end + +return debug diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua new file mode 100644 index 0000000..50b08e4 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua @@ -0,0 +1,229 @@ +---@meta io + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io"]) +--- +---@class iolib +--- +---standard input. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stdin"]) +--- +---@field stdin file* +--- +---standard output. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stdout"]) +--- +---@field stdout file* +--- +---standard error. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stderr"]) +--- +---@field stderr file* +io = {} + +---@alias openmode +---|>"r" # Read mode. +---| "w" # Write mode. +---| "a" # Append mode. +---| "r+" # Update mode, all previous data is preserved. +---| "w+" # Update mode, all previous data is erased. +---| "a+" # Append update mode, previous data is preserved, writing is only allowed at the end of file. + +--- +---Close `file` or default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.close"]) +--- +---@param file? file* +---@return boolean? suc +---@return exitcode? exitcode +---@return integer? code +function io.close(file) end + +--- +---Saves any written data to default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.flush"]) +--- +function io.flush() end + +--- +---Sets `file` as the default input file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.input"]) +--- +---@overload fun():file* +---@param file string|file* +function io.input(file) end + +--- +--------- +---```lua +---for c in io.lines(filename, ...) do +--- body +---end +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.lines"]) +--- +---@param filename string? +---@param ... readmode +---@return fun():any, ... +function io.lines(filename, ...) end + +--- +---Opens a file, in the mode specified in the string `mode`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.open"]) +--- +---@param filename string +---@param mode? openmode +---@return file*? +---@return string? errmsg +---@nodiscard +function io.open(filename, mode) end + +--- +---Sets `file` as the default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.output"]) +--- +---@overload fun():file* +---@param file string|file* +function io.output(file) end + +--- +---Reads the `file`, according to the given formats, which specify what to read. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.read"]) +--- +---@param ... readmode +---@return any +---@return any ... +---@nodiscard +function io.read(...) end + +--- +---In case of success, returns a handle for a temporary file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.tmpfile"]) +--- +---@return file* +---@nodiscard +function io.tmpfile() end + +---@alias filetype +---| "file" # Is an open file handle. +---| "closed file" # Is a closed file handle. +---| `nil` # Is not a file handle. + +--- +---Checks whether `obj` is a valid file handle. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.type"]) +--- +---@param file file* +---@return filetype +---@nodiscard +function io.type(file) end + +--- +---Writes the value of each of its arguments to default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.write"]) +--- +---@return file* +---@return string? errmsg +function io.write(...) end + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file"]) +--- +---@class file* +local file = {} + +---@alias readmode integer|string +---| "*n" # Reads a numeral and returns it as number. +---| "*a" # Reads the whole file. +---|>"*l" # Reads the next line skipping the end of line. + +---@alias exitcode "exit"|"signal" + +--- +---Close `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:close"]) +--- +---@return boolean? suc +---@return exitcode? exitcode +---@return integer? code +function file:close() end + +--- +---Saves any written data to `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:flush"]) +--- +function file:flush() end + +--- +--------- +---```lua +---for c in file:lines(...) do +--- body +---end +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:lines"]) +--- +---@param ... readmode +---@return fun():any, ... +function file:lines(...) end + +--- +---Reads the `file`, according to the given formats, which specify what to read. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:read"]) +--- +---@param ... readmode +---@return any +---@return any ... +---@nodiscard +function file:read(...) end + +---@alias seekwhence +---| "set" # Base is beginning of the file. +---|>"cur" # Base is current position. +---| "end" # Base is end of file. + +--- +---Sets and gets the file position, measured from the beginning of the file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:seek"]) +--- +---@param whence? seekwhence +---@param offset? integer +---@return integer offset +---@return string? errmsg +function file:seek(whence, offset) end + +--- +---Writes the value of each of its arguments to `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:write"]) +--- +---@param ... string|number +---@return file*? +---@return string? errmsg +function file:write(...) end + +return io diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua new file mode 100644 index 0000000..f4391ee --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua @@ -0,0 +1,282 @@ +---@meta math + +--- +--- +--- +---[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 + +---@version <5.2 +--- +---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 + + +--- +---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 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 + +---@version <5.1 +--- +---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 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.mod(x, y) 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 + +--- +---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 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 + +--- +---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 + +--- +---* `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 + +--- +---Sets `x` as the "seed" for the pseudo-random generator. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.randomseed"]) +--- +---@param x integer +function math.randomseed(x) end + + +return math diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua new file mode 100644 index 0000000..b556f9b --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua @@ -0,0 +1,239 @@ +---@meta os + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os"]) +--- +---@class oslib +os = {} + +--- +---Returns an approximation of the amount in seconds of CPU time used by the program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.clock"]) +--- +---@return number +---@nodiscard +function os.clock() end + +---@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"]) +--- +---@param format? string +---@param time? integer +---@return string|osdate +---@nodiscard +function os.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"]) +--- +---@param t2 integer +---@param t1 integer +---@return integer +---@nodiscard +function os.difftime(t2, t1) end + +--- +---Passes `command` to be executed by an operating system shell. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.execute"]) +--- +---@param command? string +---@return integer code +function os.execute(command) end + +--- +---Calls the C function `exit` to terminate the host program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.exit"]) +--- +---@param code? integer +function os.exit(code, close) end + +--- +---Returns the value of the process environment variable `varname`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.getenv"]) +--- +---@param varname string +---@return string? +---@nodiscard +function os.getenv(varname) end + +--- +---Deletes the file with the given name. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.remove"]) +--- +---@param filename string +---@return boolean suc +---@return string? errmsg +function os.remove(filename) end + +--- +---Renames the file or directory named `oldname` to `newname`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.rename"]) +--- +---@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" + +--- +---Sets the current locale of the program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.setlocale"]) +--- +---@param locale string|nil +---@param category? localecategory +---@return string localecategory +function os.setlocale(locale, category) 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"]) +--- +---@param date? osdateparam +---@return integer +---@nodiscard +function os.time(date) end + +--- +---Returns a string with a file name that can be used for a temporary file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.tmpname"]) +--- +---@return string +---@nodiscard +function os.tmpname() end + +return os diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua new file mode 100644 index 0000000..9307829 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua @@ -0,0 +1,157 @@ +---@meta string + +--- +--- +--- +---[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 + +--- +---Returns a string containing a binary representation (a *binary chunk*) of the given function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.dump"]) +--- +---@param f async fun(...):... +---@return string +---@nodiscard +function string.dump(f) 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 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 + +--- +---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 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 + +--- +---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.gfind (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 +function string.gsub(s, pattern, repl, n) end + +return string diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua new file mode 100644 index 0000000..34562db --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua @@ -0,0 +1,102 @@ +---@meta table + +--- +--- +--- +---[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 + +--- +---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"]) +--- +---@generic T +---@param list T[] +---@return integer +---@nodiscard +---@deprecated +function table.getn(list) 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 + +--- +---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 + +--- +---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 + +--- +---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.setn"]) +--- +---@generic T +---@param list T[] +---@param n number +function table.setn(list, n) end + + +return table