Comparing version 2.0.0 to 2.1.0
@@ -93,3 +93,3 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.1 | ||
*/ | ||
declare function next(table: object, index?: keyof any): [keyof any, any] | []; | ||
declare function next(table: object, index?: any): [any, any] | []; | ||
@@ -107,3 +107,3 @@ /** | ||
*/ | ||
declare function pairs<T>(t: T): [(t: T, index?: keyof any) => [keyof any, any], T]; | ||
declare function pairs<T>(t: T): [(t: T, index?: any) => [any, any], T]; | ||
@@ -110,0 +110,0 @@ /** |
@@ -99,2 +99,7 @@ // Based on https://www.lua.org/manual/5.3/manual.html#2.4 | ||
__metatable?: any; | ||
/** | ||
* Userdata finalizer code. When userdata is set to be garbage collected, if the metatable has a __gc field pointing to a function, that function is first invoked, passing the userdata to it. The __gc metamethod is not called for tables. | ||
*/ | ||
__gc?(this: T): void; | ||
} |
@@ -93,4 +93,5 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.4 | ||
* If the value returned by the table query or by the function call is a string or a number, then it is used as the replacement string; otherwise, if it is false or nil, then there is no replacement (that is, the original match is kept in the string). | ||
* @tupleReturn | ||
*/ | ||
function gsub(s: string, pattern: string, repl: string, n?: number): string; | ||
function gsub(s: string, pattern: string, repl: string, n?: number): [string, number]; | ||
@@ -97,0 +98,0 @@ /** |
@@ -21,7 +21,2 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.6 | ||
/** | ||
* Returns a new table with all parameters stored into keys 1, 2, etc. and with a field "n" with the total number of parameters. Note that the resulting table may not be a sequence. | ||
*/ | ||
function pack(...args: any[]): any[]; | ||
/** | ||
* Removes from list the element at position pos, returning the value of the removed element. When pos is an integer between 1 and #list, it shifts down the elements list[pos+1], list[pos+2], ···, list[#list] and erases element list[#list]; The index pos can also be 0 when #list is 0, or #list + 1; in those cases, the function erases the element list[pos]. | ||
@@ -31,3 +26,3 @@ * | ||
*/ | ||
function remove(list: any[], pos?: number): any[]; | ||
function remove<T>(list: T[], pos?: number): T | undefined; | ||
@@ -41,3 +36,3 @@ /** | ||
*/ | ||
function sort(list: any[], comp?: (a: any, b: any) => boolean): any[]; | ||
function sort<T>(list: T[], comp?: (a: T, b: T) => boolean): T[]; | ||
} |
{ | ||
"name": "lua-types", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "TypeScript definitions for Lua standard library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -36,2 +36,3 @@ /** | ||
* xpcall calls function f in protected mode, using err as the error handler. Any error inside f is not propagated; instead, xpcall catches the error, calls the err function with the original error object, and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In this case, xpcall also returns all results from the call, after this first result. In case of any error, xpcall returns false plus the result from err. | ||
* @tupleReturn | ||
*/ | ||
@@ -38,0 +39,0 @@ declare function xpcall<R, E>( |
@@ -36,2 +36,3 @@ /** | ||
* This function is similar to pcall, except that it sets a new message handler msgh. | ||
* @tupleReturn | ||
*/ | ||
@@ -38,0 +39,0 @@ declare function xpcall<Args extends any[], R, E>( |
@@ -59,2 +59,7 @@ declare let _ENV: Record<string, any>; | ||
function unpack<T>(list: T[], i: number, j?: number): T[]; | ||
/** | ||
* Returns a new table with all parameters stored into keys 1, 2, etc. and with a field "n" with the total number of parameters. Note that the resulting table may not be a sequence. | ||
*/ | ||
function pack<T extends any[]>(...args: T): T & { n: number }; | ||
} | ||
@@ -93,3 +98,3 @@ | ||
*/ | ||
__pairs<T>(t: T): [(t: T, index?: keyof any) => [keyof any, any], T]; | ||
__pairs?<T>(t: T): [(t: T, index?: any) => [any, any], T]; | ||
@@ -99,3 +104,3 @@ /** | ||
*/ | ||
__ipairs<T extends object>(t: T): [(t: T, index?: number) => [number, any], T, 0]; | ||
__ipairs?<T extends object>(t: T): [(t: T, index?: number) => [number, any], T, 0]; | ||
} |
@@ -87,8 +87,11 @@ /** | ||
*/ | ||
function codes<S extends string>(s: S): [(s: S, index?: number) => [number, number], S, 0]; | ||
function codes<S extends string>( | ||
s: S, | ||
): [/** @tupleReturn */ (s: S, index?: number) => [number, number], S, 0]; | ||
/** | ||
* Returns the codepoints (as integers) from all characters in s that start between byte position i and j (both included). The default for i is 1 and for j is i. It raises an error if it meets any invalid byte sequence. | ||
* @tupleReturn | ||
*/ | ||
function codepoint(s: string, i?: number, j?: number); | ||
function codepoint(s: string, i?: number, j?: number): number[]; | ||
@@ -95,0 +98,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117178
1965