@tlua/tlua-darwin-x64 0.0.13 → 0.0.15
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/lib/lib.luajit.d.tlua +71 -76
- package/lib/tlua +0 -0
- package/package.json +2 -2
package/lib/lib.luajit.d.tlua
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
// LuaJIT 2.x runtime declarations for tlua.
|
|
3
3
|
|
|
4
|
-
interface Object {}
|
|
5
|
-
interface Function {}
|
|
6
|
-
interface CallableFunction extends Function {}
|
|
7
|
-
interface NewableFunction extends Function {}
|
|
8
4
|
interface IArguments {
|
|
9
5
|
readonly length: number;
|
|
10
6
|
[index: number]: any;
|
|
@@ -21,7 +17,6 @@ interface ReadonlyArray<T> {
|
|
|
21
17
|
readonly [index: number]: T;
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
type LuaFunction = (...: any) => (any?, ...any);
|
|
25
20
|
|
|
26
21
|
// A Lua table: an open map from any non-nil key to a value. K is invariant -- it is an
|
|
27
22
|
// input when the table is indexed and an output when it is iterated with `pairs` -- so
|
|
@@ -120,7 +115,7 @@ type InstanceType<T extends new (...: any) => any> = T extends new (...: any) =>
|
|
|
120
115
|
|
|
121
116
|
/** Recursively unwrap the value type of a thenable */
|
|
122
117
|
type Awaited<T> = T extends null | undefined ? T :
|
|
123
|
-
T extends
|
|
118
|
+
T extends table & { then(onfulfilled: infer F, ...: infer _): any; } ?
|
|
124
119
|
F extends ((value: infer V, ...: infer _) => any) ?
|
|
125
120
|
Awaited<V> :
|
|
126
121
|
never :
|
|
@@ -138,7 +133,7 @@ type Capitalize<S extends string> = intrinsic;
|
|
|
138
133
|
/** Convert first character of string literal type to lowercase */
|
|
139
134
|
type Uncapitalize<S extends string> = intrinsic;
|
|
140
135
|
|
|
141
|
-
interface LuaMetatable<T extends
|
|
136
|
+
interface LuaMetatable<T extends table> {
|
|
142
137
|
__index?: Table<any, any> | ((value: T, key: any) => any);
|
|
143
138
|
__newindex?: Table<any, any> | ((value: T, key: any, newValue: any) => void);
|
|
144
139
|
__call?: (value: T, ...: any) => (any?, ...any);
|
|
@@ -173,14 +168,14 @@ declare function dofile(filename?: string): (any?, ...any);
|
|
|
173
168
|
// is optional. This matters now that forwarding a possibly-empty `...` into a
|
|
174
169
|
// required parameter is an error: `error(...)` has to keep working.
|
|
175
170
|
declare function error(message?: any, level?: number): never;
|
|
176
|
-
declare function getfenv(target?: number |
|
|
177
|
-
declare function getmetatable<T extends
|
|
171
|
+
declare function getfenv(target?: number | function): table;
|
|
172
|
+
declare function getmetatable<T extends table>(value: T): LuaMetatable<T> | any | nil;
|
|
178
173
|
declare function ipairs<T>(value: Table<number, T>): (LuaIPairsIterator<T>, Table<number, T>, number);
|
|
179
|
-
declare function load(reader: () => string | nil, chunkname?: string): (
|
|
180
|
-
declare function loadfile(filename?: string): (
|
|
181
|
-
declare function loadstring(source: string, chunkname?: string): (
|
|
182
|
-
declare function module(name: string, ...:
|
|
183
|
-
declare function newproxy(prototype?: boolean |
|
|
174
|
+
declare function load(reader: () => string | nil, chunkname?: string): (function?, string?);
|
|
175
|
+
declare function loadfile(filename?: string): (function?, string?);
|
|
176
|
+
declare function loadstring(source: string, chunkname?: string): (function?, string?);
|
|
177
|
+
declare function module(name: string, ...: function): void;
|
|
178
|
+
declare function newproxy(prototype?: boolean | userdata): userdata;
|
|
184
179
|
// next is the pairs iteration protocol, so its value is non-optional for the same
|
|
185
180
|
// reason LuaPairsIterator's is: a key it yields always has one.
|
|
186
181
|
declare function next<K, V>(value: Table<K, V>, index?: K): (K?, V);
|
|
@@ -194,7 +189,7 @@ declare function pairs<K, V>(value: Table<K, V>): (LuaPairsIterator<K, V>, Table
|
|
|
194
189
|
// one signature (inference reads a single signature), so `pcall(select, "#", 1, 2)`
|
|
195
190
|
// falls through to it instead of mis-checking against the wrong overload.
|
|
196
191
|
declare function pcall<...A, ...R>(fn: (...: A) => (...R), ...: A): (boolean, ...R);
|
|
197
|
-
declare function pcall(fn:
|
|
192
|
+
declare function pcall(fn: function, ...: any): (boolean, ...any);
|
|
198
193
|
declare function print(...: any): void;
|
|
199
194
|
declare function rawequal(left: any, right: any): boolean;
|
|
200
195
|
declare function rawget<K, V>(value: Table<K, V>, index: K): V | nil;
|
|
@@ -205,8 +200,8 @@ declare function select(index: "#", ...: any): number;
|
|
|
205
200
|
// spell -- see internal/checker/luaselect.go). This declared type is the safe
|
|
206
201
|
// fallback for a shadowed or aliased select the refinement does not reach.
|
|
207
202
|
declare function select(index: number, ...: any): (any?, ...any);
|
|
208
|
-
declare function setfenv(target: number |
|
|
209
|
-
declare function setmetatable<T extends
|
|
203
|
+
declare function setfenv(target: number | function, environment: table): function;
|
|
204
|
+
declare function setmetatable<T extends table>(value: T, metatable: LuaMetatable<T> | nil): T;
|
|
210
205
|
declare function tonumber(value: any, base?: number): number | nil;
|
|
211
206
|
declare function tostring(value: any): string;
|
|
212
207
|
declare function type(value: any): "nil" | "number" | "string" | "boolean" | "table" | "function" | "thread" | "userdata" | "cdata";
|
|
@@ -216,7 +211,7 @@ declare function unpack<T>(values: Table<number, T>, i?: number, j?: number): (T
|
|
|
216
211
|
// the success pack, so the result is approximated as `(boolean, ...R)`.
|
|
217
212
|
// The erased second overload catches overloaded callees, as pcall's does.
|
|
218
213
|
declare function xpcall<...A, ...R>(fn: (...: A) => (...R), handler: (message: any) => any, ...: A): (boolean, ...R);
|
|
219
|
-
declare function xpcall(fn:
|
|
214
|
+
declare function xpcall(fn: function, handler: (message: any) => any, ...: any): (boolean, ...any);
|
|
220
215
|
|
|
221
216
|
/*
|
|
222
217
|
* Generic pack parameters (`<...A>`) now correlate arguments and results for
|
|
@@ -224,7 +219,7 @@ declare function xpcall(fn: LuaFunction, handler: (message: any) => any, ...: an
|
|
|
224
219
|
* value-dependent choice generics cannot spell, so the checker refines it (like
|
|
225
220
|
* `type`/`io.type` narrowing). `unpack` already correlates through the ordinary
|
|
226
221
|
* generic `T`. The whole coroutine module stays erased: resume/yield because a
|
|
227
|
-
* `
|
|
222
|
+
* `thread` is opaque and carries no packs (Luau makes the same call), and wrap
|
|
228
223
|
* because a wrapped call exchanges values with `yield`, not with fn's packs.
|
|
229
224
|
*
|
|
230
225
|
* The signatures of setmetatable and getmetatable stay deliberately plain: the
|
|
@@ -247,16 +242,16 @@ declare function xpcall(fn: LuaFunction, handler: (message: any) => any, ...: an
|
|
|
247
242
|
*/
|
|
248
243
|
|
|
249
244
|
interface CoroutineLib {
|
|
250
|
-
create(fn:
|
|
251
|
-
resume(thread:
|
|
252
|
-
running():
|
|
253
|
-
status(thread:
|
|
245
|
+
create(fn: function): thread;
|
|
246
|
+
resume(thread: thread, ...: any): (boolean, ...any);
|
|
247
|
+
running(): thread | nil;
|
|
248
|
+
status(thread: thread): "running" | "suspended" | "normal" | "dead";
|
|
254
249
|
// Deliberately erased, like resume/yield: a wrapped coroutine's calls exchange
|
|
255
250
|
// values with `yield` -- the first call's results are the first yield's
|
|
256
251
|
// arguments, later calls feed yield's results -- so correlating them with fn's
|
|
257
252
|
// parameter/return packs would assert types that are wrong for every coroutine
|
|
258
253
|
// that yields, which is what wrap is for.
|
|
259
|
-
wrap(fn:
|
|
254
|
+
wrap(fn: function): function;
|
|
260
255
|
yield(...: any): (any?, ...any);
|
|
261
256
|
}
|
|
262
257
|
|
|
@@ -268,7 +263,7 @@ interface String {
|
|
|
268
263
|
find(pattern: string, init?: number, plain?: boolean): (number?, number?, ...string);
|
|
269
264
|
format(...: any): string;
|
|
270
265
|
gmatch(pattern: string): () => string;
|
|
271
|
-
gsub(pattern: string, replacement: string |
|
|
266
|
+
gsub(pattern: string, replacement: string | table | function, n?: number): (string, number);
|
|
272
267
|
len(): number;
|
|
273
268
|
lower(): string;
|
|
274
269
|
match(pattern: string, init?: number): (string?, ...string);
|
|
@@ -281,11 +276,11 @@ interface String {
|
|
|
281
276
|
interface StringLib {
|
|
282
277
|
byte(value: string, i?: number, j?: number): (number?, ...number);
|
|
283
278
|
char(...: number): string;
|
|
284
|
-
dump(fn:
|
|
279
|
+
dump(fn: function): string;
|
|
285
280
|
find(value: string, pattern: string, init?: number, plain?: boolean): (number?, number?, ...string);
|
|
286
281
|
format(format: string, ...: any): string;
|
|
287
282
|
gmatch(value: string, pattern: string): () => string;
|
|
288
|
-
gsub(value: string, pattern: string, replacement: string |
|
|
283
|
+
gsub(value: string, pattern: string, replacement: string | table | function, n?: number): (string, number);
|
|
289
284
|
len(value: string): number;
|
|
290
285
|
lower(value: string): string;
|
|
291
286
|
match(value: string, pattern: string, init?: number): (string?, ...string);
|
|
@@ -354,7 +349,7 @@ type LuaReadFormat = "*n" | "*a" | "*l" | number;
|
|
|
354
349
|
interface LuaFile extends LuaUserdata {
|
|
355
350
|
close(): (boolean | nil, string?);
|
|
356
351
|
flush(): (boolean | nil, string?);
|
|
357
|
-
lines(...: LuaReadFormat):
|
|
352
|
+
lines(...: LuaReadFormat): function;
|
|
358
353
|
read(...: LuaReadFormat): (any, ...any);
|
|
359
354
|
seek(whence?: "set" | "cur" | "end", offset?: number): (number | nil, string?);
|
|
360
355
|
setvbuf(mode: "no" | "full" | "line", size?: number): (boolean | nil, string?);
|
|
@@ -368,7 +363,7 @@ interface IOLib {
|
|
|
368
363
|
close(file?: LuaFile): (boolean | nil, string?);
|
|
369
364
|
flush(): (boolean | nil, string?);
|
|
370
365
|
input(file?: string | LuaFile): LuaFile;
|
|
371
|
-
lines(filename?: string, ...: LuaReadFormat):
|
|
366
|
+
lines(filename?: string, ...: LuaReadFormat): function;
|
|
372
367
|
open(filename: string, mode?: string): (LuaFile?, string?);
|
|
373
368
|
output(file?: string | LuaFile): LuaFile;
|
|
374
369
|
popen(command: string, mode?: "r" | "w"): (LuaFile?, string?);
|
|
@@ -423,13 +418,13 @@ interface PackageLib {
|
|
|
423
418
|
readonly config: string;
|
|
424
419
|
readonly cpath: string;
|
|
425
420
|
readonly loaded: {[name: string]: any};
|
|
426
|
-
readonly loaders: ((name: string) =>
|
|
421
|
+
readonly loaders: ((name: string) => function | string)[];
|
|
427
422
|
readonly path: string;
|
|
428
|
-
readonly preload: {[name: string]:
|
|
429
|
-
readonly searchers: ((name: string) =>
|
|
430
|
-
loadlib(library: string, functionName: string): (
|
|
423
|
+
readonly preload: {[name: string]: function};
|
|
424
|
+
readonly searchers: ((name: string) => function | string)[];
|
|
425
|
+
loadlib(library: string, functionName: string): (function | nil, string?);
|
|
431
426
|
searchpath(name: string, path: string, separator?: string, replacement?: string): (string?, string?);
|
|
432
|
-
seeall(module:
|
|
427
|
+
seeall(module: table): void;
|
|
433
428
|
}
|
|
434
429
|
|
|
435
430
|
declare package: PackageLib;
|
|
@@ -444,31 +439,31 @@ interface LuaDebugInfo {
|
|
|
444
439
|
name?: string;
|
|
445
440
|
namewhat?: string;
|
|
446
441
|
nups?: number;
|
|
447
|
-
func?:
|
|
442
|
+
func?: function;
|
|
448
443
|
activelines?: {[line: number]: boolean};
|
|
449
444
|
}
|
|
450
445
|
|
|
451
446
|
interface DebugLib {
|
|
452
447
|
debug(): void;
|
|
453
|
-
getfenv(value: any):
|
|
454
|
-
gethook(): (
|
|
455
|
-
gethook(thread:
|
|
456
|
-
getinfo(fn: number |
|
|
457
|
-
getinfo(thread:
|
|
448
|
+
getfenv(value: any): table;
|
|
449
|
+
gethook(): (function?, string?, number?);
|
|
450
|
+
gethook(thread: thread): (function?, string?, number?);
|
|
451
|
+
getinfo(fn: number | function, what?: string): LuaDebugInfo | nil;
|
|
452
|
+
getinfo(thread: thread, fn: number | function, what?: string): LuaDebugInfo | nil;
|
|
458
453
|
getlocal(level: number, localIndex: number): (string?, any);
|
|
459
|
-
getlocal(thread:
|
|
460
|
-
getmetatable(value: any):
|
|
461
|
-
getregistry():
|
|
462
|
-
getupvalue(fn:
|
|
463
|
-
setfenv(value: any, environment:
|
|
464
|
-
sethook(hook?:
|
|
465
|
-
sethook(thread:
|
|
454
|
+
getlocal(thread: thread, level: number, localIndex: number): (string?, any);
|
|
455
|
+
getmetatable(value: any): table | nil;
|
|
456
|
+
getregistry(): table;
|
|
457
|
+
getupvalue(fn: function, index: number): (string?, any);
|
|
458
|
+
setfenv(value: any, environment: table): any;
|
|
459
|
+
sethook(hook?: function, mask?: string, count?: number): void;
|
|
460
|
+
sethook(thread: thread, hook?: function, mask?: string, count?: number): void;
|
|
466
461
|
setlocal(level: number, localIndex: number, value: any): string | nil;
|
|
467
|
-
setlocal(thread:
|
|
468
|
-
setmetatable<T>(value: T, metatable:
|
|
469
|
-
setupvalue(fn:
|
|
462
|
+
setlocal(thread: thread, level: number, localIndex: number, value: any): string | nil;
|
|
463
|
+
setmetatable<T>(value: T, metatable: table | nil): T;
|
|
464
|
+
setupvalue(fn: function, index: number, value: any): string | nil;
|
|
470
465
|
traceback(message?: any, level?: number): string;
|
|
471
|
-
traceback(thread:
|
|
466
|
+
traceback(thread: thread, message?: any, level?: number): string;
|
|
472
467
|
}
|
|
473
468
|
|
|
474
469
|
declare debug: DebugLib;
|
|
@@ -499,9 +494,9 @@ interface JITLib {
|
|
|
499
494
|
readonly version_num: number;
|
|
500
495
|
readonly os: "Windows" | "Linux" | "OSX" | "BSD" | "POSIX" | "Other";
|
|
501
496
|
readonly arch: string;
|
|
502
|
-
on(fn?:
|
|
503
|
-
off(fn?:
|
|
504
|
-
flush(fn?:
|
|
497
|
+
on(fn?: function | boolean, recursive?: boolean): void;
|
|
498
|
+
off(fn?: function | boolean, recursive?: boolean): void;
|
|
499
|
+
flush(fn?: function | boolean, recursive?: boolean): void;
|
|
505
500
|
flush(trace: number): void;
|
|
506
501
|
status(): (boolean, ...string);
|
|
507
502
|
readonly opt: JITOptLib;
|
|
@@ -517,20 +512,20 @@ interface LuaCData {
|
|
|
517
512
|
|
|
518
513
|
interface LuaCType {
|
|
519
514
|
readonly __ffiCTypeBrand: unique symbol;
|
|
520
|
-
(...: any):
|
|
515
|
+
(...: any): cdata;
|
|
521
516
|
}
|
|
522
517
|
|
|
523
518
|
interface LuaCallback extends LuaCData {
|
|
524
519
|
readonly __ffiCallbackBrand: unique symbol;
|
|
525
520
|
free(): void;
|
|
526
|
-
set(fn:
|
|
521
|
+
set(fn: function): void;
|
|
527
522
|
}
|
|
528
523
|
|
|
529
524
|
interface LuaCNamespace {
|
|
530
525
|
[name: string]: any;
|
|
531
526
|
}
|
|
532
527
|
|
|
533
|
-
type LuaCTypeSpec = LuaCType | string |
|
|
528
|
+
type LuaCTypeSpec = LuaCType | string | cdata;
|
|
534
529
|
|
|
535
530
|
interface FFILib {
|
|
536
531
|
readonly C: LuaCNamespace;
|
|
@@ -538,11 +533,11 @@ interface FFILib {
|
|
|
538
533
|
readonly arch: string;
|
|
539
534
|
cdef(definition: string): void;
|
|
540
535
|
load(name: string, global?: boolean): LuaCNamespace;
|
|
541
|
-
"new": (type: LuaCTypeSpec, ...: any) =>
|
|
536
|
+
"new": (type: LuaCTypeSpec, ...: any) => cdata;
|
|
542
537
|
"typeof": (type: LuaCTypeSpec, ...: any) => LuaCType;
|
|
543
|
-
cast(type: LuaCTypeSpec, initializer: any):
|
|
544
|
-
metatype(type: LuaCTypeSpec, metatable:
|
|
545
|
-
gc(value:
|
|
538
|
+
cast(type: LuaCTypeSpec, initializer: any): cdata;
|
|
539
|
+
metatype(type: LuaCTypeSpec, metatable: table): LuaCType;
|
|
540
|
+
gc(value: cdata, finalizer?: function): cdata;
|
|
546
541
|
sizeof(type: LuaCTypeSpec, count?: number): number | nil;
|
|
547
542
|
alignof(type: LuaCTypeSpec): number;
|
|
548
543
|
offsetof(type: LuaCTypeSpec, field: string): (number, number?, number?);
|
|
@@ -558,10 +553,10 @@ interface FFILib {
|
|
|
558
553
|
declare ffi: FFILib;
|
|
559
554
|
|
|
560
555
|
interface JITProfileLib {
|
|
561
|
-
start(mode: string, callback: (thread:
|
|
556
|
+
start(mode: string, callback: (thread: thread, samples: number, vmstate: string) => void): void;
|
|
562
557
|
stop(): void;
|
|
563
558
|
dumpstack(format: string, depth: number): string;
|
|
564
|
-
dumpstack(thread:
|
|
559
|
+
dumpstack(thread: thread, format: string, depth: number): string;
|
|
565
560
|
}
|
|
566
561
|
|
|
567
562
|
interface JITFunctionInfo {
|
|
@@ -591,10 +586,10 @@ interface JITTraceInfo {
|
|
|
591
586
|
}
|
|
592
587
|
|
|
593
588
|
interface JITUtilLib {
|
|
594
|
-
funcinfo(fn:
|
|
595
|
-
funcbc(fn:
|
|
596
|
-
funck(fn:
|
|
597
|
-
funcuvname(fn:
|
|
589
|
+
funcinfo(fn: function, pc?: number): JITFunctionInfo;
|
|
590
|
+
funcbc(fn: function, pc: number): (number?, number?);
|
|
591
|
+
funck(fn: function, index: number): any;
|
|
592
|
+
funcuvname(fn: function, index: number): string | nil;
|
|
598
593
|
traceinfo(trace: number): JITTraceInfo | nil;
|
|
599
594
|
traceir(trace: number, reference: number): (number?, number?, number?, number?, number?);
|
|
600
595
|
tracek(trace: number, index: number): (any?, number?, number?);
|
|
@@ -606,25 +601,25 @@ interface JITUtilLib {
|
|
|
606
601
|
}
|
|
607
602
|
|
|
608
603
|
interface LuaStringBuffer {
|
|
609
|
-
put(value: string | number |
|
|
610
|
-
putf(format: string, ...: string | number |
|
|
611
|
-
putcdata(value:
|
|
612
|
-
set(value: string |
|
|
604
|
+
put(value: string | number | table, ...: string | number | table): LuaStringBuffer;
|
|
605
|
+
putf(format: string, ...: string | number | table): LuaStringBuffer;
|
|
606
|
+
putcdata(value: cdata, length: number): LuaStringBuffer;
|
|
607
|
+
set(value: string | cdata, length?: number): LuaStringBuffer;
|
|
613
608
|
reset(): LuaStringBuffer;
|
|
614
609
|
free(): void;
|
|
615
|
-
reserve(size: number): (
|
|
610
|
+
reserve(size: number): (cdata, number);
|
|
616
611
|
commit(used: number): LuaStringBuffer;
|
|
617
612
|
skip(length: number): LuaStringBuffer;
|
|
618
613
|
get(length?: number, ...: number | nil): (string, ...string);
|
|
619
614
|
tostring(): string;
|
|
620
|
-
ref(): (
|
|
615
|
+
ref(): (cdata, number);
|
|
621
616
|
encode(value: any): LuaStringBuffer;
|
|
622
617
|
decode(): any;
|
|
623
618
|
}
|
|
624
619
|
|
|
625
620
|
interface StringBufferOptions {
|
|
626
621
|
dict?: string[];
|
|
627
|
-
metatable?:
|
|
622
|
+
metatable?: table[];
|
|
628
623
|
}
|
|
629
624
|
|
|
630
625
|
interface StringBufferLib {
|
|
@@ -634,9 +629,9 @@ interface StringBufferLib {
|
|
|
634
629
|
decode(value: string): any;
|
|
635
630
|
}
|
|
636
631
|
|
|
637
|
-
type TableClear = (value:
|
|
632
|
+
type TableClear = (value: table) => void;
|
|
638
633
|
|
|
639
|
-
type TableNew = (arraySize: number, hashSize: number) =>
|
|
634
|
+
type TableNew = (arraySize: number, hashSize: number) => table;
|
|
640
635
|
|
|
641
636
|
declare function require(module: "bit"): BitLib;
|
|
642
637
|
declare function require(module: "jit"): JITLib;
|
package/lib/tlua
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tlua/tlua-darwin-x64",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "tlua",
|
|
6
6
|
"homepage": "https://github.com/apyrr/tlua",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"exports": {
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "420f9a7f944e2a346b530bc9fdbab6e6a6bcbc72",
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|
|
38
38
|
"tag": "latest"
|