lua-types
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -23,8 +23,2 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.2 | ||
/** | ||
* Returns the running coroutine plus a boolean, true when the running coroutine is the main one. | ||
* @tupleReturn | ||
*/ | ||
function running(): [LuaThread, boolean]; | ||
/** | ||
* Returns the status of coroutine co, as a string: "running", if the coroutine is running (that is, it called status); "suspended", if the coroutine is suspended in a call to yield, or if it has not started running yet; "normal" if the coroutine is active but not running (that is, it has resumed another coroutine); and "dead" if the coroutine has finished its body function, or if it has stopped with an error. | ||
@@ -31,0 +25,0 @@ */ |
@@ -20,4 +20,7 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.1 | ||
* Calls 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!" | ||
* @tupleReturn | ||
*/ | ||
declare function assert<T>(v: T, message?: string): Exclude<T, false | null | undefined>; | ||
declare function assert<T extends any[]>( | ||
...args: T | ||
): { [P in keyof T]: P extends '0' ? Exclude<T[P], false | null | undefined> : T[P] }; | ||
@@ -125,2 +128,4 @@ /** | ||
): [true, R] | [false, string]; | ||
/** @tupleReturn */ | ||
declare function pcall<A extends any[], R>( | ||
@@ -127,0 +132,0 @@ f: (this: void, ...args: A) => R, |
@@ -117,3 +117,3 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.4 | ||
*/ | ||
function match(s: string, pattern: string, init?: number): string | null; | ||
function match(s: string, pattern: string, init?: number): string[]; | ||
@@ -120,0 +120,0 @@ /** |
@@ -36,3 +36,3 @@ // Based on https://www.lua.org/manual/5.3/manual.html#6.6 | ||
*/ | ||
function sort<T>(list: T[], comp?: (a: T, b: T) => boolean): T[]; | ||
function sort<T>(list: T[], comp?: (a: T, b: T) => boolean): void; | ||
} |
{ | ||
"name": "lua-types", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"description": "TypeScript definitions for Lua standard library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -71,3 +71,4 @@ /** @noSelfInFile */ | ||
function getlocal(level: number, local: number): [string, any]; | ||
/** @tupleReturn */ | ||
function getlocal(thread: LuaThread, level: number, local: number): [string, any]; | ||
} |
@@ -19,2 +19,3 @@ /** @noSelfInFile */ | ||
declare function unpack<T extends any[]>(list: T): T; | ||
/** @tupleReturn */ | ||
declare function unpack<T>(list: T[], i: number, j?: number): T[]; | ||
@@ -94,1 +95,8 @@ | ||
} | ||
declare namespace coroutine { | ||
/** | ||
* Returns the running coroutine, or nil when called by the main thread. | ||
*/ | ||
function running(): LuaThread | undefined; | ||
} |
@@ -42,10 +42,12 @@ /** @noSelfInFile */ | ||
f: (this: This, ...args: Args) => R, | ||
msgh: (err: any) => E, | ||
msgh: (this: void, err: any) => E, | ||
context: This, | ||
...args: Args | ||
): [true, R] | [false, E]; | ||
declare function xpcall<A extends any[], R, E>( | ||
f: (this: void, ...args: A) => R, | ||
/** @tupleReturn */ | ||
declare function xpcall<Args extends any[], R, E>( | ||
f: (this: void, ...args: Args) => R, | ||
msgh: (err: any) => E, | ||
...args: A | ||
...args: Args | ||
): [true, R] | [false, E]; | ||
@@ -70,2 +72,3 @@ | ||
function getlocal(f: Function | number, local: number): [string, any]; | ||
/** @tupleReturn */ | ||
function getlocal(thread: LuaThread, f: Function | number, local: number): [string, any]; | ||
@@ -72,0 +75,0 @@ |
@@ -59,2 +59,3 @@ /** @noSelfInFile */ | ||
function unpack<T extends any[]>(list: T): T; | ||
/** @tupleReturn */ | ||
function unpack<T>(list: T[], i: number, j?: number): T[]; | ||
@@ -106,1 +107,9 @@ | ||
} | ||
declare namespace coroutine { | ||
/** | ||
* Returns the running coroutine plus a boolean, true when the running coroutine is the main one. | ||
* @tupleReturn | ||
*/ | ||
function running(): [LuaThread, boolean]; | ||
} |
117838
2008