@gwigz/slua-types 0.3.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/index.d.ts +65 -36
  2. package/package.json +4 -1
package/index.d.ts CHANGED
@@ -291,6 +291,35 @@ declare type OsDateTime = {
291
291
  yday?: number
292
292
  isdst?: boolean
293
293
  }
294
+ /** Configuration options for lljson encoding */
295
+ declare type LLJsonEncodeOptions = {
296
+ tight?: boolean
297
+ skip_tojson?: boolean
298
+ allow_sparse?: boolean
299
+ replacer: ((this: void, key: any, value: any, parent: any[] | undefined) => any) | undefined
300
+ }
301
+ declare type LLJsonDecodeReviverWithoutPath = (
302
+ this: void,
303
+ key: string | number,
304
+ value: any,
305
+ parent: any[] | undefined,
306
+ ctx: any[],
307
+ ) => any
308
+ declare type LLJsonDecodeOptionsWithoutPath =
309
+ | { track_path?: false; reviver?: LLJsonDecodeReviverWithoutPath }
310
+ | LLJsonDecodeReviverWithoutPath
311
+ declare type LLJsonDecodeOptionsWithPath = {
312
+ track_path: true
313
+ reviver: (
314
+ this: void,
315
+ key: string | number,
316
+ value: any,
317
+ parent: any[] | undefined,
318
+ ctx: { path: (string | number)[] },
319
+ ) => any
320
+ }
321
+ /** Configuration options for lljson decoding */
322
+ declare type LLJsonDecodeOptions = LLJsonDecodeOptionsWithoutPath | LLJsonDecodeOptionsWithPath
294
323
 
295
324
  /** Event registration and management class for Second Life events */
296
325
  declare interface LLEvents {
@@ -300,9 +329,9 @@ declare interface LLEvents {
300
329
  off<E extends keyof LLEventMap>(event: E, callback: LLEventMap[E]): boolean
301
330
  /** Registers a one-time callback. Returns the wrapper function. */
302
331
  once<E extends keyof LLEventMap>(event: E, callback: LLEventMap[E]): LLEventMap[E]
303
- /** Returns a list of all listeners for a specific event. */
304
- listeners<E extends keyof LLEventMap>(event: E): LLEventMap[E][]
305
- /** Returns a list of all event names that have listeners. */
332
+ /** Returns a list of all handlers for a specific event. */
333
+ handlers<E extends keyof LLEventMap>(event: E): LLEventMap[E][]
334
+ /** Returns a list of all event names that have handlers. */
306
335
  eventNames(): (keyof LLEventMap)[]
307
336
  }
308
337
 
@@ -704,29 +733,29 @@ declare namespace llbase64 {
704
733
  /** @noSelf */
705
734
  declare namespace lljson {
706
735
  /** Encodes a Lua value as JSON. Raises an error if value contains unsupported types. */
707
- export function encode(value: any): string
736
+ export function encode(value: any, options?: LLJsonEncodeOptions): string
708
737
 
709
738
  /** Decodes a JSON string to a Lua value. Raises an error if JSON is invalid. */
710
- export function decode(json: string): any
739
+ export function decode(json: string, options?: LLJsonDecodeOptions): any
711
740
 
712
741
  /** Encodes a Lua value as JSON, preserving SL types. Use tight to encode more compactly. Raises an error if value contains unsupported types. */
713
- export function slencode(value: any, tight?: boolean): string
742
+ export function slencode(value: any, options?: LLJsonEncodeOptions): string
714
743
 
715
744
  /** Decodes a JSON string to a Lua value, preserving SL types. Raises an error if JSON is invalid. */
716
- export function sldecode(json: string): any
745
+ export function sldecode(json: string, options?: LLJsonDecodeOptions): any
717
746
 
718
- /** A constant to pass for null to json encode */
747
+ /** A constant to pass for null to json encode. */
719
748
  export const null_: any
720
- /** Metatable for declaring table as an empty array for json encode */
721
- export const empty_array_mt: Record<any, any>
722
- /** Metatable for declaring table as an array for json encode */
723
- export const array_mt: Record<any, any>
724
- /** A constant to pass for an empty array to json encode */
725
- export const empty_array: any
726
- /** Name of the lljson library */
727
- export const _NAME: string
728
- /** Version of the lljson library */
729
- export const _VERSION: string
749
+ /** A constant to return from a reviver/replacer replacer function to omit this item. */
750
+ export const remove: any
751
+ /** Metatable for declaring table as an array for json encode. */
752
+ export const array_mt: { __jsonhint: string }
753
+ /** Metatable for declaring table as an object for json encode. */
754
+ export const object_mt: { __jsonhint: string }
755
+ /** A constant to pass for an empty array to json encode. */
756
+ export const empty_array: any[]
757
+ /** A constant to pass for an empty object to json encode. */
758
+ export const empty_object: any[]
730
759
  }
731
760
 
732
761
  /** Mathematical functions library. */
@@ -4314,7 +4343,7 @@ declare const COMBAT_CHANNEL: number
4314
4343
  * Messages from the region to the COMBAT_CHANNEL will all be from this ID.
4315
4344
  * Scripts may filter llListen calls on this ID to receive only system generated combat log messages.
4316
4345
  */
4317
- declare const COMBAT_LOG_ID: string
4346
+ declare const COMBAT_LOG_ID: uuid
4318
4347
  /** "application/atom+xml" */
4319
4348
  declare const CONTENT_TYPE_ATOM: number
4320
4349
  /** "application/x-www-form-urlencoded" */
@@ -4513,17 +4542,17 @@ declare const HTTP_PRAGMA_NO_CACHE: number
4513
4542
  declare const HTTP_USER_AGENT: number
4514
4543
  declare const HTTP_VERBOSE_THROTTLE: number
4515
4544
  declare const HTTP_VERIFY_CERT: number
4516
- declare const IMG_USE_BAKED_AUX1: string
4517
- declare const IMG_USE_BAKED_AUX2: string
4518
- declare const IMG_USE_BAKED_AUX3: string
4519
- declare const IMG_USE_BAKED_EYES: string
4520
- declare const IMG_USE_BAKED_HAIR: string
4521
- declare const IMG_USE_BAKED_HEAD: string
4522
- declare const IMG_USE_BAKED_LEFTARM: string
4523
- declare const IMG_USE_BAKED_LEFTLEG: string
4524
- declare const IMG_USE_BAKED_LOWER: string
4525
- declare const IMG_USE_BAKED_SKIRT: string
4526
- declare const IMG_USE_BAKED_UPPER: string
4545
+ declare const IMG_USE_BAKED_AUX1: uuid
4546
+ declare const IMG_USE_BAKED_AUX2: uuid
4547
+ declare const IMG_USE_BAKED_AUX3: uuid
4548
+ declare const IMG_USE_BAKED_EYES: uuid
4549
+ declare const IMG_USE_BAKED_HAIR: uuid
4550
+ declare const IMG_USE_BAKED_HEAD: uuid
4551
+ declare const IMG_USE_BAKED_LEFTARM: uuid
4552
+ declare const IMG_USE_BAKED_LEFTLEG: uuid
4553
+ declare const IMG_USE_BAKED_LOWER: uuid
4554
+ declare const IMG_USE_BAKED_SKIRT: uuid
4555
+ declare const IMG_USE_BAKED_UPPER: uuid
4527
4556
  declare const INVENTORY_ALL: number
4528
4557
  declare const INVENTORY_ANIMATION: number
4529
4558
  declare const INVENTORY_BODYPART: number
@@ -4656,7 +4685,7 @@ declare const MASK_OWNER: number
4656
4685
  /** Indicates a notecard read was attempted and the notecard was not yet cached on the server. */
4657
4686
  declare const NAK: string
4658
4687
  declare const NAVIGATE_TO_GOAL_REACHED_DIST: number
4659
- declare const NULL_KEY: string
4688
+ declare const NULL_KEY: uuid
4660
4689
  /**
4661
4690
  * Retrieves the account level of an avatar.
4662
4691
  * Returns 0 when the avatar has a basic account,
@@ -5623,11 +5652,11 @@ declare const TERRAIN_PBR_SCALE_1: number
5623
5652
  declare const TERRAIN_PBR_SCALE_2: number
5624
5653
  declare const TERRAIN_PBR_SCALE_3: number
5625
5654
  declare const TERRAIN_PBR_SCALE_4: number
5626
- declare const TEXTURE_BLANK: string
5627
- declare const TEXTURE_DEFAULT: string
5628
- declare const TEXTURE_MEDIA: string
5629
- declare const TEXTURE_PLYWOOD: string
5630
- declare const TEXTURE_TRANSPARENT: string
5655
+ declare const TEXTURE_BLANK: uuid
5656
+ declare const TEXTURE_DEFAULT: uuid
5657
+ declare const TEXTURE_MEDIA: uuid
5658
+ declare const TEXTURE_PLYWOOD: uuid
5659
+ declare const TEXTURE_TRANSPARENT: uuid
5631
5660
  declare const TOUCH_INVALID_FACE: number
5632
5661
  declare const TOUCH_INVALID_TEXCOORD: vector
5633
5662
  declare const TOUCH_INVALID_VECTOR: vector
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gwigz/slua-types",
3
- "version": "0.3.0",
3
+ "version": "1.0.1",
4
4
  "description": "TypeScript type definitions for Second Life's SLua runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,9 @@
13
13
  "modules"
14
14
  ],
15
15
  "types": "index.d.ts",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
16
19
  "peerDependencies": {
17
20
  "@typescript-to-lua/language-extensions": "^1.0.0"
18
21
  }