@gwigz/slua-types 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +134 -52
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -59,10 +59,7 @@ declare class Vector {
|
|
|
59
59
|
|
|
60
60
|
declare type vector = Vector;
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Event detection class providing access to detected object/avatar information
|
|
64
|
-
* @noSelf
|
|
65
|
-
*/
|
|
62
|
+
/** Event detection class providing access to detected object/avatar information */
|
|
66
63
|
declare interface DetectedEvent {
|
|
67
64
|
readonly index: number;
|
|
68
65
|
readonly valid: boolean;
|
|
@@ -212,12 +209,12 @@ declare type list = (string | number | vector | uuid | quaternion | boolean)[];
|
|
|
212
209
|
declare type LLDetectedEventName = "collision" | "collision_end" | "collision_start" | "final_damage" | "on_damage" | "sensor" | "touch" | "touch_end" | "touch_start";
|
|
213
210
|
declare type LLNonDetectedEventName = "at_rot_target" | "at_target" | "attach" | "changed" | "control" | "dataserver" | "email" | "experience_permissions" | "experience_permissions_denied" | "game_control" | "http_request" | "http_response" | "land_collision" | "land_collision_end" | "land_collision_start" | "link_message" | "linkset_data" | "listen" | "money" | "moving_end" | "moving_start" | "no_sensor" | "not_at_rot_target" | "not_at_target" | "object_rez" | "on_death" | "on_rez" | "path_update" | "remote_data" | "run_time_permissions" | "timer" | "transaction_result";
|
|
214
211
|
declare type LLEventName = keyof LLEventMap;
|
|
215
|
-
declare type LLEventHandler = (...args: any[]) => void;
|
|
216
|
-
declare type LLDetectedEventHandler = (detected: DetectedEvent[]) => void;
|
|
212
|
+
declare type LLEventHandler = (this: void, ...args: any[]) => void;
|
|
213
|
+
declare type LLDetectedEventHandler = (this: void, detected: DetectedEvent[]) => void;
|
|
217
214
|
/** Callback type for LLTimers.every() - receives scheduled time and interval */
|
|
218
|
-
declare type LLTimerEveryCallback = (scheduled: number, interval: number) => void;
|
|
215
|
+
declare type LLTimerEveryCallback = (this: void, scheduled: number, interval: number) => void;
|
|
219
216
|
/** Callback type for LLTimers.once() - receives scheduled time */
|
|
220
|
-
declare type LLTimerOnceCallback = (scheduled: number) => void;
|
|
217
|
+
declare type LLTimerOnceCallback = (this: void, scheduled: number) => void;
|
|
221
218
|
/** Union of timer callback types */
|
|
222
219
|
declare type LLTimerCallback = LLTimerEveryCallback | LLTimerOnceCallback;
|
|
223
220
|
/** Date/time table structure used by os.date and os.time */
|
|
@@ -254,59 +251,140 @@ declare const LLEvents: LLEvents;
|
|
|
254
251
|
/** Timer management singleton for scheduling periodic and one-time callbacks. */
|
|
255
252
|
declare const LLTimers: LLTimers;
|
|
256
253
|
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Dangerously executes a required module function
|
|
256
|
+
* @noSelf
|
|
257
|
+
*/
|
|
258
|
+
declare function dangerouslyexecuterequiredmodule(f: (this: void, ...args: any[]) => any[]): any[];
|
|
259
|
+
/**
|
|
260
|
+
* Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID, or the the buffer is shorter than 16 bytes.
|
|
261
|
+
* @noSelf
|
|
262
|
+
*/
|
|
260
263
|
declare function touuid(val: string | undefined | buffer | uuid): uuid | undefined;
|
|
261
|
-
/**
|
|
264
|
+
/**
|
|
265
|
+
* Converts a string to a vector, returns nil if invalid
|
|
266
|
+
* @noSelf
|
|
267
|
+
*/
|
|
262
268
|
declare function tovector(val: string | undefined | vector): vector | undefined;
|
|
263
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* Converts a string to a quaternion, returns nil if invalid
|
|
271
|
+
* @noSelf
|
|
272
|
+
*/
|
|
264
273
|
declare function toquaternion(val: string | undefined | quaternion): quaternion | undefined;
|
|
265
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Converts a string to a rotation (quaternion), returns nil if invalid
|
|
276
|
+
* @noSelf
|
|
277
|
+
*/
|
|
266
278
|
declare function torotation(val: string | undefined | quaternion): quaternion | undefined;
|
|
267
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Checks if the value is truthy; if not, raises an error with the optional message.
|
|
281
|
+
* @noSelf
|
|
282
|
+
*/
|
|
268
283
|
declare function assert<T>(value?: T, message?: string): T;
|
|
269
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* Raises an error with the specified object and optional call stack level.
|
|
286
|
+
* @noSelf
|
|
287
|
+
*/
|
|
270
288
|
declare function error(obj: any, level?: number): never;
|
|
271
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* Returns the total heap size in kilobytes.
|
|
291
|
+
* @noSelf
|
|
292
|
+
*/
|
|
272
293
|
declare function gcinfo(): number;
|
|
273
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Returns the metatable for the specified object.
|
|
296
|
+
* @noSelf
|
|
297
|
+
*/
|
|
274
298
|
declare function getmetatable(obj: any): Record<any, any> | undefined;
|
|
275
|
-
/**
|
|
299
|
+
/**
|
|
300
|
+
* Returns the next key-value pair in the table traversal order.
|
|
301
|
+
* @noSelf
|
|
302
|
+
*/
|
|
276
303
|
declare function next<K, V>(t: Record<K, V>, i?: K): LuaMultiReturn<[K, V]> | undefined;
|
|
277
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* Creates a new untyped userdata object with an optional metatable.
|
|
306
|
+
* @noSelf
|
|
307
|
+
*/
|
|
278
308
|
declare function newproxy(mt?: boolean): any;
|
|
279
|
-
/**
|
|
309
|
+
/**
|
|
310
|
+
* Prints all arguments to standard output using Tab as a separator.
|
|
311
|
+
* @noSelf
|
|
312
|
+
*/
|
|
280
313
|
declare function print(...args: any[]): void;
|
|
281
|
-
/**
|
|
314
|
+
/**
|
|
315
|
+
* Returns true if a and b have the same type and value.
|
|
316
|
+
* @noSelf
|
|
317
|
+
*/
|
|
282
318
|
declare function rawequal(a: any, b: any): boolean;
|
|
283
|
-
/**
|
|
319
|
+
/**
|
|
320
|
+
* Performs a table lookup bypassing metatables.
|
|
321
|
+
* @noSelf
|
|
322
|
+
*/
|
|
284
323
|
declare function rawget<K, V>(t: Record<K, V>, k: K): V | undefined;
|
|
285
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* Assigns a value to a table field bypassing metatables.
|
|
326
|
+
* @noSelf
|
|
327
|
+
*/
|
|
286
328
|
declare function rawset<K, V>(t: Record<K, V>, k: K, v: V): Record<K, V>;
|
|
287
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Returns the length of a table or string bypassing metatables.
|
|
331
|
+
* @noSelf
|
|
332
|
+
*/
|
|
288
333
|
declare function rawlen<K, V>(t: Record<any, any> | string): number;
|
|
289
|
-
/**
|
|
334
|
+
/**
|
|
335
|
+
* Returns a subset of arguments or the number of arguments.
|
|
336
|
+
* @noSelf
|
|
337
|
+
*/
|
|
290
338
|
declare function select(i: string | number, ...args: any[]): any;
|
|
291
|
-
/**
|
|
339
|
+
/**
|
|
340
|
+
* Changes the metatable for the given table.
|
|
341
|
+
* @noSelf
|
|
342
|
+
*/
|
|
292
343
|
declare function setmetatable(t: Record<any, any>, mt?: Record<any, any>): void;
|
|
293
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* Converts the input string to a number in the specified base.
|
|
346
|
+
* @noSelf
|
|
347
|
+
*/
|
|
294
348
|
declare function tonumber(s: string, base?: number): number | undefined;
|
|
295
|
-
/**
|
|
349
|
+
/**
|
|
350
|
+
* Converts the input object to a string.
|
|
351
|
+
* @noSelf
|
|
352
|
+
*/
|
|
296
353
|
declare function tostring(obj: any): string;
|
|
297
|
-
/**
|
|
354
|
+
/**
|
|
355
|
+
* Returns the type of the object as a string.
|
|
356
|
+
* @noSelf
|
|
357
|
+
*/
|
|
298
358
|
declare function type(obj: any): string;
|
|
299
|
-
/**
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
359
|
+
/**
|
|
360
|
+
* Returns an iterator for numeric key-value pairs in the table.
|
|
361
|
+
* @noSelf
|
|
362
|
+
*/
|
|
363
|
+
declare function ipairs<V>(t: V[]): LuaMultiReturn<[(this: void, arg0: V[], arg1: number) => LuaMultiReturn<[number | undefined, V]>, V[], number]>;
|
|
364
|
+
/**
|
|
365
|
+
* Returns an iterator for all key-value pairs in the table.
|
|
366
|
+
* @noSelf
|
|
367
|
+
*/
|
|
368
|
+
declare function pairs<K, V>(t: Record<K, V>): LuaMultiReturn<[(this: void, arg0: Record<K, V>, arg1: K) => LuaMultiReturn<[K | undefined, V]>, Record<K, V>, K]>;
|
|
369
|
+
/**
|
|
370
|
+
* Calls function f with parameters args, returning success and function results or an error.
|
|
371
|
+
* @noSelf
|
|
372
|
+
*/
|
|
304
373
|
declare function pcall(f: (...args: any[]) => any, ...args: any[][]): any;
|
|
305
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Calls function f with parameters args, handling errors with e if they occur.
|
|
376
|
+
* @noSelf
|
|
377
|
+
*/
|
|
306
378
|
declare function xpcall<E>(f: (...args: any[]) => any, e: (...args: any[]) => any, ...args: any[][]): any;
|
|
307
|
-
/**
|
|
379
|
+
/**
|
|
380
|
+
* Execute the named external module.
|
|
381
|
+
* @noSelf
|
|
382
|
+
*/
|
|
308
383
|
declare function require(target: string): any;
|
|
309
|
-
/**
|
|
384
|
+
/**
|
|
385
|
+
* Returns values from an array in the specified index range.
|
|
386
|
+
* @noSelf
|
|
387
|
+
*/
|
|
310
388
|
declare function unpack<V>(a: V[], f?: number, t?: number): V[];
|
|
311
389
|
|
|
312
390
|
/** Bitwise operations library. */
|
|
@@ -450,7 +528,7 @@ declare namespace buffer {
|
|
|
450
528
|
/** @noSelf */
|
|
451
529
|
declare namespace coroutine {
|
|
452
530
|
/** Returns a new coroutine that, when resumed, will run function f. */
|
|
453
|
-
export function create(f: (...args: any[]) => any[]): LuaThread;
|
|
531
|
+
export function create(f: (this: void, ...args: any[]) => any[]): LuaThread;
|
|
454
532
|
|
|
455
533
|
/** Resumes a coroutine, returning true and results if successful, or false and an error. */
|
|
456
534
|
export function resume(co: LuaThread, ...args: any[]): LuaMultiReturn<[boolean, ...args: any[]]>;
|
|
@@ -462,7 +540,7 @@ declare namespace coroutine {
|
|
|
462
540
|
export function status(co: LuaThread): "running" | "suspended" | "normal" | "dead";
|
|
463
541
|
|
|
464
542
|
/** Creates a coroutine and returns a function that resumes it. */
|
|
465
|
-
export function wrap(f: (...args: any[]) => any[]): (...args: any[]) => any[];
|
|
543
|
+
export function wrap(f: (this: void, ...args: any[]) => any[]): (this: void, ...args: any[]) => any[];
|
|
466
544
|
|
|
467
545
|
/** Yields the current coroutine, passing arguments to the resuming code. */
|
|
468
546
|
export function yield(...args: any[]): any[];
|
|
@@ -478,13 +556,13 @@ declare namespace coroutine {
|
|
|
478
556
|
/** @noSelf */
|
|
479
557
|
declare namespace debug {
|
|
480
558
|
/** Returns information about a stack frame or function based on specified format. */
|
|
481
|
-
export function info(co: LuaThread | ((...args: any[]) => any[]) | number, level: number, s: string): any[];
|
|
559
|
+
export function info(co: LuaThread | ((this: void, ...args: any[]) => any[]) | number, level: number, s: string): any[];
|
|
482
560
|
|
|
483
561
|
/** Returns a human-readable call stack starting from the specified level. */
|
|
484
562
|
export function traceback(co: LuaThread, msg?: string, level?: number): string;
|
|
485
563
|
|
|
486
564
|
/** Returns a table containing debug information about a function or stack frame. */
|
|
487
|
-
export function getinfo(thread: LuaThread, function_: ((...args: any[]) => any[]) | number, what: string): Record<any, any>;
|
|
565
|
+
export function getinfo(thread: LuaThread, function_: ((this: void, ...args: any[]) => any[]) | number, what: string): Record<any, any>;
|
|
488
566
|
|
|
489
567
|
/** Returns the name and value of a local variable at the specified stack level. */
|
|
490
568
|
export function getlocal(level: number, index: number): string | any;
|
|
@@ -493,10 +571,10 @@ declare namespace debug {
|
|
|
493
571
|
export function setlocal(level: number, index: number, value: any): boolean;
|
|
494
572
|
|
|
495
573
|
/** Returns the name and value of an upvalue for a given function. */
|
|
496
|
-
export function getupvalue(function_: (...args: any[]) => any[], index: number): string | any;
|
|
574
|
+
export function getupvalue(function_: (this: void, ...args: any[]) => any[], index: number): string | any;
|
|
497
575
|
|
|
498
576
|
/** Sets the value of an upvalue for a given function. */
|
|
499
|
-
export function setupvalue(function_: (...args: any[]) => any[], index: number, value: any): string;
|
|
577
|
+
export function setupvalue(function_: (this: void, ...args: any[]) => any[], index: number, value: any): string;
|
|
500
578
|
|
|
501
579
|
/** Returns the metatable of the given value, if any. */
|
|
502
580
|
export function getmetatable(value: any): Record<any, any> | undefined;
|
|
@@ -721,7 +799,9 @@ declare namespace Quaternion {
|
|
|
721
799
|
/** @noSelf */
|
|
722
800
|
declare namespace string {
|
|
723
801
|
/** Returns the numeric code of every byte in the input string within the given range. */
|
|
724
|
-
export function byte(s: string, i?: number
|
|
802
|
+
export function byte(s: string, i?: number): number;
|
|
803
|
+
|
|
804
|
+
export function byte(s: string, i: number, j: number): number[];
|
|
725
805
|
|
|
726
806
|
/** Returns a string containing characters for the given byte values. */
|
|
727
807
|
export function char(...args: number[]): string;
|
|
@@ -733,10 +813,10 @@ declare namespace string {
|
|
|
733
813
|
export function format(formatstring: string, ...args: any[]): string;
|
|
734
814
|
|
|
735
815
|
/** Returns an iterator function for pattern matches */
|
|
736
|
-
export function gmatch(s: string, pattern: string): () => string[];
|
|
816
|
+
export function gmatch(s: string, pattern: string): (this: void) => string[];
|
|
737
817
|
|
|
738
818
|
/** Performs pattern-based substitution in a string. */
|
|
739
|
-
export function gsub(s: string, pattern: string, repl: string | Record<string, string> | ((...args: string[]) => string), maxn?: number): LuaMultiReturn<[string, number]>;
|
|
819
|
+
export function gsub(s: string, pattern: string, repl: string | Record<string, string> | ((this: void, ...args: string[]) => string), maxn?: number): LuaMultiReturn<[string, number]>;
|
|
740
820
|
|
|
741
821
|
/** Returns the number of bytes in the string. Identical to #s */
|
|
742
822
|
export function len(s: string): number;
|
|
@@ -782,13 +862,13 @@ declare namespace table {
|
|
|
782
862
|
* Iterates over all key-value pairs in the table (deprecated).
|
|
783
863
|
* @deprecated Use a for loop instead
|
|
784
864
|
*/
|
|
785
|
-
export function foreach<K, V, R>(t: Record<K, V>, f?: (key: K, value: V) => R): R | undefined;
|
|
865
|
+
export function foreach<K, V, R>(t: Record<K, V>, f?: (this: void, key: K, value: V) => R): R | undefined;
|
|
786
866
|
|
|
787
867
|
/**
|
|
788
868
|
* Iterates over all index-value pairs in the array (deprecated).
|
|
789
869
|
* @deprecated Use a for loop instead
|
|
790
870
|
*/
|
|
791
|
-
export function foreachi<V, R>(a: V[], f?: (index: number, value: V) => R): R | undefined;
|
|
871
|
+
export function foreachi<V, R>(a: V[], f?: (this: void, index: number, value: V) => R): R | undefined;
|
|
792
872
|
|
|
793
873
|
/**
|
|
794
874
|
* Returns the length of an array (deprecated; use # instead).
|
|
@@ -812,7 +892,7 @@ declare namespace table {
|
|
|
812
892
|
export function remove<V>(a: V[], i?: number): V | undefined;
|
|
813
893
|
|
|
814
894
|
/** Sorts an array in place. */
|
|
815
|
-
export function sort<V>(a: V[], f?: (a: V, b: V) => boolean): void;
|
|
895
|
+
export function sort<V>(a: V[], f?: (this: void, a: V, b: V) => boolean): void;
|
|
816
896
|
|
|
817
897
|
/** Packs multiple arguments into a new array with length field n. */
|
|
818
898
|
export function pack<V>(...args: V[]): { n: number; [index: number]: V };
|
|
@@ -852,10 +932,12 @@ declare namespace utf8 {
|
|
|
852
932
|
export function char(...args: number[]): string;
|
|
853
933
|
|
|
854
934
|
/** Returns an iterator that produces the byte offset and Unicode codepoint for each character in the string. */
|
|
855
|
-
export function codes(s: string): LuaMultiReturn<[(arg0: string, arg1: number) => LuaMultiReturn<[number, number]>, string, number]>;
|
|
935
|
+
export function codes(s: string): LuaMultiReturn<[(this: void, arg0: string, arg1: number) => LuaMultiReturn<[number, number]>, string, number]>;
|
|
856
936
|
|
|
857
937
|
/** Returns the Unicode codepoints in the specified range of the string. */
|
|
858
|
-
export function codepoint(s: string, i?: number
|
|
938
|
+
export function codepoint(s: string, i?: number): number;
|
|
939
|
+
|
|
940
|
+
export function codepoint(s: string, i: number, j: number): number[];
|
|
859
941
|
|
|
860
942
|
/** Returns the number of Unicode codepoints in the specified range of the string, or nil and error index. */
|
|
861
943
|
export function len(s: string, i?: number, j?: number): LuaMultiReturn<[number | undefined, number | undefined]>;
|