@tlua/tlua-win32-arm64 0.0.12 → 0.0.14

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.
@@ -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 object & { then(onfulfilled: infer F, ...: infer _): any; } ?
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 object> {
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,13 +168,13 @@ 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 | LuaFunction): object;
177
- declare function getmetatable<T extends object>(value: T): LuaMetatable<T> | any | nil;
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): (LuaFunction?, string?);
180
- declare function loadfile(filename?: string): (LuaFunction?, string?);
181
- declare function loadstring(source: string, chunkname?: string): (LuaFunction?, string?);
182
- declare function module(name: string, ...: LuaFunction): void;
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;
183
178
  declare function newproxy(prototype?: boolean | LuaUserdata): LuaUserdata;
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.
@@ -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: LuaFunction, ...: any): (boolean, ...any);
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 | LuaFunction, environment: object): LuaFunction;
209
- declare function setmetatable<T extends object>(value: T, metatable: LuaMetatable<T> | nil): T;
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: LuaFunction, handler: (message: any) => any, ...: any): (boolean, ...any);
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
@@ -233,7 +228,11 @@ declare function xpcall(fn: LuaFunction, handler: (message: any) => any, ...: an
233
228
  * reads, __newindex writes to a missing key, __call, __metatable protection, and
234
229
  * the operator metamethods (__eq __lt __le __unm __len __add __sub __mul __div
235
230
  * __mod __pow __concat) -- and getmetatable reads that metatable back;
236
- * setmetatable as a statement narrows its table argument the same way.
231
+ * setmetatable as a statement narrows its table argument the same way. Operator
232
+ * metamethods also dispatch ambiently: a declared type that states them as
233
+ * `__add`-style members (a userdata class like GMod's Vector) overloads the
234
+ * operators with no setmetatable in sight; __index, __newindex and __call stay
235
+ * pairing-only.
237
236
  * debug.setmetatable and debug.getmetatable bypass __metatable protection. A
238
237
  * shadowed local of either name keeps whatever it declares. Both signatures still
239
238
  * carry the contract this file can express: the parameter type is what validates a
@@ -243,7 +242,7 @@ declare function xpcall(fn: LuaFunction, handler: (message: any) => any, ...: an
243
242
  */
244
243
 
245
244
  interface CoroutineLib {
246
- create(fn: LuaFunction): LuaThread;
245
+ create(fn: function): LuaThread;
247
246
  resume(thread: LuaThread, ...: any): (boolean, ...any);
248
247
  running(): LuaThread | nil;
249
248
  status(thread: LuaThread): "running" | "suspended" | "normal" | "dead";
@@ -252,7 +251,7 @@ interface CoroutineLib {
252
251
  // arguments, later calls feed yield's results -- so correlating them with fn's
253
252
  // parameter/return packs would assert types that are wrong for every coroutine
254
253
  // that yields, which is what wrap is for.
255
- wrap(fn: LuaFunction): LuaFunction;
254
+ wrap(fn: function): function;
256
255
  yield(...: any): (any?, ...any);
257
256
  }
258
257
 
@@ -264,7 +263,7 @@ interface String {
264
263
  find(pattern: string, init?: number, plain?: boolean): (number?, number?, ...string);
265
264
  format(...: any): string;
266
265
  gmatch(pattern: string): () => string;
267
- gsub(pattern: string, replacement: string | object | LuaFunction, n?: number): (string, number);
266
+ gsub(pattern: string, replacement: string | table | function, n?: number): (string, number);
268
267
  len(): number;
269
268
  lower(): string;
270
269
  match(pattern: string, init?: number): (string?, ...string);
@@ -277,11 +276,11 @@ interface String {
277
276
  interface StringLib {
278
277
  byte(value: string, i?: number, j?: number): (number?, ...number);
279
278
  char(...: number): string;
280
- dump(fn: LuaFunction): string;
279
+ dump(fn: function): string;
281
280
  find(value: string, pattern: string, init?: number, plain?: boolean): (number?, number?, ...string);
282
281
  format(format: string, ...: any): string;
283
282
  gmatch(value: string, pattern: string): () => string;
284
- gsub(value: string, pattern: string, replacement: string | object | LuaFunction, n?: number): (string, number);
283
+ gsub(value: string, pattern: string, replacement: string | table | function, n?: number): (string, number);
285
284
  len(value: string): number;
286
285
  lower(value: string): string;
287
286
  match(value: string, pattern: string, init?: number): (string?, ...string);
@@ -350,7 +349,7 @@ type LuaReadFormat = "*n" | "*a" | "*l" | number;
350
349
  interface LuaFile extends LuaUserdata {
351
350
  close(): (boolean | nil, string?);
352
351
  flush(): (boolean | nil, string?);
353
- lines(...: LuaReadFormat): LuaFunction;
352
+ lines(...: LuaReadFormat): function;
354
353
  read(...: LuaReadFormat): (any, ...any);
355
354
  seek(whence?: "set" | "cur" | "end", offset?: number): (number | nil, string?);
356
355
  setvbuf(mode: "no" | "full" | "line", size?: number): (boolean | nil, string?);
@@ -364,7 +363,7 @@ interface IOLib {
364
363
  close(file?: LuaFile): (boolean | nil, string?);
365
364
  flush(): (boolean | nil, string?);
366
365
  input(file?: string | LuaFile): LuaFile;
367
- lines(filename?: string, ...: LuaReadFormat): LuaFunction;
366
+ lines(filename?: string, ...: LuaReadFormat): function;
368
367
  open(filename: string, mode?: string): (LuaFile?, string?);
369
368
  output(file?: string | LuaFile): LuaFile;
370
369
  popen(command: string, mode?: "r" | "w"): (LuaFile?, string?);
@@ -419,13 +418,13 @@ interface PackageLib {
419
418
  readonly config: string;
420
419
  readonly cpath: string;
421
420
  readonly loaded: {[name: string]: any};
422
- readonly loaders: ((name: string) => LuaFunction | string)[];
421
+ readonly loaders: ((name: string) => function | string)[];
423
422
  readonly path: string;
424
- readonly preload: {[name: string]: LuaFunction};
425
- readonly searchers: ((name: string) => LuaFunction | string)[];
426
- loadlib(library: string, functionName: string): (LuaFunction | nil, string?);
423
+ readonly preload: {[name: string]: function};
424
+ readonly searchers: ((name: string) => function | string)[];
425
+ loadlib(library: string, functionName: string): (function | nil, string?);
427
426
  searchpath(name: string, path: string, separator?: string, replacement?: string): (string?, string?);
428
- seeall(module: object): void;
427
+ seeall(module: table): void;
429
428
  }
430
429
 
431
430
  declare package: PackageLib;
@@ -440,29 +439,29 @@ interface LuaDebugInfo {
440
439
  name?: string;
441
440
  namewhat?: string;
442
441
  nups?: number;
443
- func?: LuaFunction;
442
+ func?: function;
444
443
  activelines?: {[line: number]: boolean};
445
444
  }
446
445
 
447
446
  interface DebugLib {
448
447
  debug(): void;
449
- getfenv(value: any): object;
450
- gethook(): (LuaFunction?, string?, number?);
451
- gethook(thread: LuaThread): (LuaFunction?, string?, number?);
452
- getinfo(fn: number | LuaFunction, what?: string): LuaDebugInfo | nil;
453
- getinfo(thread: LuaThread, fn: number | LuaFunction, what?: string): LuaDebugInfo | nil;
448
+ getfenv(value: any): table;
449
+ gethook(): (function?, string?, number?);
450
+ gethook(thread: LuaThread): (function?, string?, number?);
451
+ getinfo(fn: number | function, what?: string): LuaDebugInfo | nil;
452
+ getinfo(thread: LuaThread, fn: number | function, what?: string): LuaDebugInfo | nil;
454
453
  getlocal(level: number, localIndex: number): (string?, any);
455
454
  getlocal(thread: LuaThread, level: number, localIndex: number): (string?, any);
456
- getmetatable(value: any): object | nil;
457
- getregistry(): object;
458
- getupvalue(fn: LuaFunction, index: number): (string?, any);
459
- setfenv(value: any, environment: object): any;
460
- sethook(hook?: LuaFunction, mask?: string, count?: number): void;
461
- sethook(thread: LuaThread, hook?: LuaFunction, mask?: string, count?: number): void;
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: LuaThread, hook?: function, mask?: string, count?: number): void;
462
461
  setlocal(level: number, localIndex: number, value: any): string | nil;
463
462
  setlocal(thread: LuaThread, level: number, localIndex: number, value: any): string | nil;
464
- setmetatable<T>(value: T, metatable: object | nil): T;
465
- setupvalue(fn: LuaFunction, index: number, value: any): string | nil;
463
+ setmetatable<T>(value: T, metatable: table | nil): T;
464
+ setupvalue(fn: function, index: number, value: any): string | nil;
466
465
  traceback(message?: any, level?: number): string;
467
466
  traceback(thread: LuaThread, message?: any, level?: number): string;
468
467
  }
@@ -495,9 +494,9 @@ interface JITLib {
495
494
  readonly version_num: number;
496
495
  readonly os: "Windows" | "Linux" | "OSX" | "BSD" | "POSIX" | "Other";
497
496
  readonly arch: string;
498
- on(fn?: LuaFunction | boolean, recursive?: boolean): void;
499
- off(fn?: LuaFunction | boolean, recursive?: boolean): void;
500
- flush(fn?: LuaFunction | boolean, recursive?: boolean): void;
497
+ on(fn?: function | boolean, recursive?: boolean): void;
498
+ off(fn?: function | boolean, recursive?: boolean): void;
499
+ flush(fn?: function | boolean, recursive?: boolean): void;
501
500
  flush(trace: number): void;
502
501
  status(): (boolean, ...string);
503
502
  readonly opt: JITOptLib;
@@ -519,7 +518,7 @@ interface LuaCType {
519
518
  interface LuaCallback extends LuaCData {
520
519
  readonly __ffiCallbackBrand: unique symbol;
521
520
  free(): void;
522
- set(fn: LuaFunction): void;
521
+ set(fn: function): void;
523
522
  }
524
523
 
525
524
  interface LuaCNamespace {
@@ -537,8 +536,8 @@ interface FFILib {
537
536
  "new": (type: LuaCTypeSpec, ...: any) => LuaCData;
538
537
  "typeof": (type: LuaCTypeSpec, ...: any) => LuaCType;
539
538
  cast(type: LuaCTypeSpec, initializer: any): LuaCData;
540
- metatype(type: LuaCTypeSpec, metatable: object): LuaCType;
541
- gc(value: LuaCData, finalizer?: LuaFunction): LuaCData;
539
+ metatype(type: LuaCTypeSpec, metatable: table): LuaCType;
540
+ gc(value: LuaCData, finalizer?: function): LuaCData;
542
541
  sizeof(type: LuaCTypeSpec, count?: number): number | nil;
543
542
  alignof(type: LuaCTypeSpec): number;
544
543
  offsetof(type: LuaCTypeSpec, field: string): (number, number?, number?);
@@ -587,10 +586,10 @@ interface JITTraceInfo {
587
586
  }
588
587
 
589
588
  interface JITUtilLib {
590
- funcinfo(fn: LuaFunction, pc?: number): JITFunctionInfo;
591
- funcbc(fn: LuaFunction, pc: number): (number?, number?);
592
- funck(fn: LuaFunction, index: number): any;
593
- funcuvname(fn: LuaFunction, index: number): string | nil;
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;
594
593
  traceinfo(trace: number): JITTraceInfo | nil;
595
594
  traceir(trace: number, reference: number): (number?, number?, number?, number?, number?);
596
595
  tracek(trace: number, index: number): (any?, number?, number?);
@@ -602,8 +601,8 @@ interface JITUtilLib {
602
601
  }
603
602
 
604
603
  interface LuaStringBuffer {
605
- put(value: string | number | object, ...: string | number | object): LuaStringBuffer;
606
- putf(format: string, ...: string | number | object): LuaStringBuffer;
604
+ put(value: string | number | table, ...: string | number | table): LuaStringBuffer;
605
+ putf(format: string, ...: string | number | table): LuaStringBuffer;
607
606
  putcdata(value: LuaCData, length: number): LuaStringBuffer;
608
607
  set(value: string | LuaCData, length?: number): LuaStringBuffer;
609
608
  reset(): LuaStringBuffer;
@@ -620,7 +619,7 @@ interface LuaStringBuffer {
620
619
 
621
620
  interface StringBufferOptions {
622
621
  dict?: string[];
623
- metatable?: object[];
622
+ metatable?: table[];
624
623
  }
625
624
 
626
625
  interface StringBufferLib {
@@ -630,9 +629,9 @@ interface StringBufferLib {
630
629
  decode(value: string): any;
631
630
  }
632
631
 
633
- type TableClear = (value: object) => void;
632
+ type TableClear = (value: table) => void;
634
633
 
635
- type TableNew = (arraySize: number, hashSize: number) => object;
634
+ type TableNew = (arraySize: number, hashSize: number) => table;
636
635
 
637
636
  declare function require(module: "bit"): BitLib;
638
637
  declare function require(module: "jit"): JITLib;
package/lib/tlua.exe CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tlua/tlua-win32-arm64",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
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": "50b14103f434ff5207bbedf563a57a9f5b1d7225",
35
+ "gitHead": "33ca336d9d59d6a33a71fba67d684d66cea519d9",
36
36
  "publishConfig": {
37
37
  "access": "public",
38
38
  "tag": "latest"