-- Crabsoup APIs declare CSV: typeof(CSV) & { unsafe_from_string: (string) -> {{string}}?, } declare JSON: typeof(JSON) & { unsafe_from_string: (string) -> any?, } declare String: typeof(String) & { is_valid_utf8: (str: string) -> boolean, length: (str: string) -> number, length_ascii: (str: string) -> number, trim: (s: string) -> string, to_number: typeof(tonumber), join: (sep: string, list: { string }) -> string, starts_with: (s: string, prefix: string) -> boolean, ends_with: (s: string, prefix: string) -> boolean, } declare Sys: typeof(Sys) & { run_program: (string) -> (), run_program_get_exit_code: (string) -> number, get_program_output: (string) -> string, random: (number) -> number, strip_extensions: (path: string) -> string, } declare Table: typeof(Table) & { has_key: (value: { [K]: V }, key: K) -> boolean, copy: (value: { [K]: V }) -> { [K]: V }, } declare TOML: typeof(TOML) & { unsafe_from_string: (string) -> any?, } declare Value: typeof(Value) & { is_nil: (value: T) -> boolean, is_float: (value: T) -> boolean, is_string: (value: T) -> boolean, is_table: (value: T) -> boolean, is_html: (value: T) -> boolean, } declare YAML: typeof(YAML) & { unsafe_from_string: (string) -> any?, } -- HTML library declare HTML: typeof(HTML) & { select_any_of: (node: NodeRef, selectors: {string}) -> NodeRef, select_all_of: (node: NodeRef, selectors: {string}) -> {NodeRef}, matches_selector: (root: NodeRef, node: NodeRef, selector: string) -> boolean, matches_any_of_selectors: (root: NodeRef, node: NodeRef, selectors: {string}) -> boolean, append_root: (parent: NodeRef, child: NodeRef) -> (), prepend_root: (parent: NodeRef, child: NodeRef) -> (), replace: (from: NodeRef, with: NodeRef) -> (), clone_content: (NodeRef) -> NodeRef, clone_document: (NodeRef) -> NodeRef, } -- Unique global functions declare function dostring(src: string | () -> string, chunkname: string?, mode: string?, env: { [string]: any }?): any declare function nextvar(name: any): (any, any) declare function setglobal(name: string, value: T) declare function getglobal(name: string): T declare function setfallback(fallbackname: string, newfallback: any) -- Base functions declare strfind: typeof(string.find) declare strlen: typeof(string.len) declare strsub: typeof(string.sub) declare strlower: typeof(string.lower) declare strupper: typeof(string.upper) declare strrep: typeof(string.rep) declare ascii: typeof(string.byte) declare format: typeof(string.format) declare gsub: typeof(string.gsub) declare abs: typeof(math.abs) declare acos: typeof(math.acos) declare asin: typeof(math.asin) declare atan: typeof(math.atan) declare atan2: typeof(math.atan2) declare ceil: typeof(math.ceil) declare cos: typeof(math.cos) declare floor: typeof(math.floor) declare log: typeof(math.log) declare log10: typeof(math.log10) declare max: typeof(math.max) declare min: typeof(math.min) declare sin: typeof(math.sin) declare sqrt: typeof(math.sqrt) declare tan: typeof(math.tan) declare random: typeof(math.random) declare randomseed: typeof(math.randomseed) declare function mod(lhs: number, rhs: number): number -- Lua-ML functions declare size: typeof(Table.length)