@tlua/tlua-win32-arm64 0.0.39 → 0.0.41

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.
@@ -171,7 +171,7 @@ declare function select(index: "#", ...: any): number;
171
171
  // fallback for a shadowed or aliased select the refinement does not reach.
172
172
  declare function select(index: number, ...: any): (any?, ...any);
173
173
  declare function setfenv(target: number | function, environment: table): function;
174
- declare function setmetatable<T extends table>(value: T, metatable: LuaMetatable<T> | nil): T;
174
+ declare function setmetatable<T extends table>(value: T, metatable: LuaMetatable<NoInfer<T>> | nil): T;
175
175
  declare function tonumber(value: any, base?: number): number | nil;
176
176
  declare function tostring(value: any): string;
177
177
  declare function type(value: any): "nil" | "number" | "string" | "boolean" | "table" | "function" | "thread" | "userdata" | "cdata";
@@ -191,6 +191,10 @@ declare function xpcall(fn: function, handler: (message: any) => any, ...: any):
191
191
  * generic `T`. The whole coroutine module stays erased: resume/yield because a
192
192
  * `thread` is opaque and carries no packs (Luau makes the same call), and wrap
193
193
  * because a wrapped call exchanges values with `yield`, not with fn's packs.
194
+ * That erasure is about packs only -- `coroutine.yield` still carries the suspend
195
+ * flag, because it is the primitive the whole contract is founded on. `resume`
196
+ * and a wrapped function do not: driving a coroutine from ordinary code is what
197
+ * they are for.
194
198
  *
195
199
  * The signatures of setmetatable and getmetatable stay deliberately plain: the
196
200
  * checker pairs a table with its metatable itself. A call to the *global*
@@ -209,8 +213,8 @@ declare function xpcall(fn: function, handler: (message: any) => any, ...: any):
209
213
  * shadowed local of either name keeps whatever it declares. Both signatures still
210
214
  * carry the contract this file can express: the parameter type is what validates a
211
215
  * metatable's metamethods, and precision comes from the metatable a call passes,
212
- * since LuaMetatable<T> | nil names no particular fallback. Still uninterpreted:
213
- * __tostring and ffi.metatype.
216
+ * since LuaMetatable<T> | nil names no particular fallback; NoInfer pins it so only
217
+ * the table operand chooses T. Still uninterpreted: __tostring and ffi.metatype.
214
218
  */
215
219
 
216
220
  interface CoroutineLib {
@@ -224,7 +228,16 @@ interface CoroutineLib {
224
228
  // parameter/return packs would assert types that are wrong for every coroutine
225
229
  // that yields, which is what wrap is for.
226
230
  wrap(fn: function): function;
227
- yield(...: any): (any?, ...any);
231
+ // `yield` is the primitive that actually suspends the running coroutine, so
232
+ // it anchors the suspend contract: everything else marked `suspend` is marked
233
+ // by hand, and this is the one signature the contract can be founded on. A
234
+ // function whose body yields must therefore declare itself `suspend`, and a
235
+ // yield reached from ordinary code -- the runtime's "attempt to yield from
236
+ // outside a coroutine" -- is a diagnostic instead. The `suspend` modifier is
237
+ // illegal in an ambient context, so this is a property carrying a suspend
238
+ // function *type*; the argument and result types stay erased exactly as
239
+ // resume's do. Widening to the `function` top type is the escape hatch.
240
+ yield: suspend (...: any) => (any?, ...any);
228
241
  }
229
242
 
230
243
  declare coroutine: CoroutineLib;
@@ -440,7 +453,7 @@ interface DebugLib {
440
453
  sethook(thread: thread, hook?: function, mask?: string, count?: number): void;
441
454
  setlocal(level: number, localIndex: number, value: any): string | nil;
442
455
  setlocal(thread: thread, level: number, localIndex: number, value: any): string | nil;
443
- setmetatable<T extends table>(value: T, metatable: LuaMetatable<T> | nil): T;
456
+ setmetatable<T extends table>(value: T, metatable: LuaMetatable<NoInfer<T>> | nil): T;
444
457
  setmetatable<T>(value: T, metatable: table | nil): T;
445
458
  setupvalue(fn: function, index: number, value: any): string | nil;
446
459
  traceback(message?: any, level?: number): string;
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.39",
3
+ "version": "0.0.41",
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": "ceb3aad61277942534ec4f882575ed35b308ae34",
35
+ "gitHead": "dd6b5325381492d6e366c9e39fccdb5eab0d9db1",
36
36
  "publishConfig": {
37
37
  "access": "public",
38
38
  "tag": "latest"