dreamworkAPI
Ctrl K
GitHub
referenceDocs / Aliases

Aliases

Type aliases (---@alias) used across the API.

#ascii.integer

ValueDescription
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29
30 | 31 | 32 | 33 | 34 | 35

#AsyncIterator<K,

V> futures.AsyncIterator<K, V>

Abstract type that is used to type hint async functions.

#Awaitable

futures.Awaitable

#BinaryWriter.Buffer

integer[] | ffi.cdata*

#checksum.CRCTables

table<integer, table<integer, integer>>

#Class.__inherited

fun( parent: Class, child: Class )

#Class.__new

fun( cls: Class, ...: any? ): Object | nil

#Color

integer

#console.Command.AutoComplete

console.Command.SimpleAutoComplete | console.Command.FullAutoComplete

Autocomplete callback of a console command, either simple or full.

See SimpleAutoComplete and FullAutoComplete for the return value semantics.

#console.Command.Callback

fun( command: console.Command, client: garrysmod.Player | nil, args: string[], argument_string: string )

Handler of a console command, called every time the command is executed.

Parameters:

  • command: the command that was executed.
  • client: the player who executed the command, nil when executed from the server console.
  • args: the parsed arguments.
  • argument_string: the raw argument string typed after the command name (surrounding quotes are stripped).

#console.Command.FullAutoComplete

fun( command: console.Command, argument_string: string, args: string[] ): boolean, string[] | nil

Full autocomplete callback.

The first return value controls how the second one is treated:

  • true: the suggestions are prefixed with the command name and a space, same as in the simple callback.
  • false: the suggestions are passed to the engine as is, so each entry must already contain the full line (including the command name).

Returning nil (or throwing an error) falls back to the engine's default behavior.

Parameters:

  • command: the command that is being autocompleted.
  • argument_string: the raw argument string typed after the command name.
  • args: the parsed arguments.

#console.Command.SimpleAutoComplete

fun( command: console.Command, argument_string: string, args: string[] ): string[] | nil

Simple autocomplete callback.

Returns a list of suggestions, each one is the text that follows the command name, the command name and a space are prepended to every entry automatically.

Example: for command my_cmd returning { "foo", "bar" } the console shows my_cmd foo and my_cmd bar.

Returning nil (or throwing an error) falls back to the engine's default behavior.

Parameters:

  • command: the command that is being autocompleted.
  • argument_string: the raw argument string typed after the command name.
  • args: the parsed arguments.

#console.Flags

ValueDescription
"unregistered"
"development_only"
"game_dll"
"client_dll"
"hidden"
"protected"
"sponly"
"archive"
"notify"
"userinfo"
"cheat"
"printable_only"
"unlogged"
"never_as_string"
"replicated"
"demo"
"dont_record"
"reload_materials"
"reload_textures"
"not_connected"
"material_system_thread"
"archive_xbox"
"accessible_from_threads"
"server_can_execute"
"server_cannot_query"
"clientcmd_can_execute"
"material_thread_mask"
"lua_client"
"lua_server"

#console.VariableType

"boolean" | "string" | "integer" | "number"

The value type of a console variable.

#console.VariableValue

boolean | number | string | integer

The value of a console variable, depends on its console.VariableType.

#deflate.Bytes

ffi.cdata* | integer[]

#deflate.Input

string | ffi.cdata*

#dreamwork.vfs.Storage

ValueDescription
"mount"Provided by the search path of a mount, the mount fields are set.
"memory"A memory file or directory, the upper layer created where the search path is read-only or there is none.
"none"An intermediate directory created on the way to mount points, it holds nothing by itself.

#Emitter.Handler

function | Hook | Event

A function, or a callable object such as a Hook or an Event (called through its __call metamethod).

#Event.Handler

function | Event

A function, or a callable object such as another Event (called through its __call metamethod).

#fluent.Argument

string | number | FluentType

The value of a variable passed to FluentBundle:formatPattern, numbers become fluent.Number, timestamps must be wrapped in fluent.DateTime.

#fluent.CallArgument

fluent.Expression | fluent.NamedArgument

#fluent.Category

"zero" | "one" | "two" | "few" | "many" | "other"

The CLDR plural category.

#fluent.Expression

fluent.StringLiteral | fluent.NumberLiteral | fluent.VariableReference | fluent.MessageReference | fluent.TermReference | fluent.FunctionReference | fluent.SelectExpression

#fluent.Function

fun( positional: fluent.Value[], named: table<string, fluent.Value> ): fluent.Value | number

The function callable from FTL, e.g. { NUMBER( $count, minimumFractionDigits: 2 ) }.

Function names must be upper-case, the returned numbers are wrapped in fluent.Number.

#fluent.Literal

fluent.StringLiteral | fluent.NumberLiteral

#fluent.Pattern

string | fluent.PatternElement[]

The pattern, a plain string if it has no placeables.

#fluent.PatternElement

string | fluent.Expression

#fluent.PluralRule

fun( n: number, i: number, v: integer, f: number, t: number, w: integer ): fluent.Category

The CLDR plural rule, receives the plural operands of the absolute value:

  • n - the absolute value;
  • i - the integer digits;
  • v - the number of visible fraction digits, with trailing zeros;
  • f - the visible fraction digits, with trailing zeros;
  • t - the visible fraction digits, without trailing zeros;
  • w - the number of visible fraction digits, without trailing zeros.

#fluent.Value

string | FluentType

The resolved value of an expression, strings or Fluent types ( fluent.None, fluent.Number, fluent.DateTime ).

#futures.AsyncIterator<K,

V> table<K, V> | nil

Abstract type that is used to type hint async functions.

#futures.Awaitable

{ await: async fun(...): ... }

#gc.Instruction

fun( object: garrysmod.Entity | garrysmod.Player | integer ): any

Maps the destroyed object to the key that must be removed from the tracked table.

Returning nil or false falls back to the destroyed object itself.

#gc.Type

The kind of object whose destruction clears the tracked table.

ValueDescription
"Entity"The entity object, any removed entity.
"EntityID"The entity index (integer), any removed networked entity.
"Player"The player object, any removed player.
"UserID"The player user id (integer), any removed player.
"SteamID32"The player Steam steam id32 (integer), any removed non-bot player.

#gfx3d.ModelFlags

ValueDescription
1 STUDIO_RENDERThe current render is for opaque renderables only.
2 STUDIO_VIEWXFORMATTACHMENTSApplies view-space transforms to model attachments (used for attachment positioning/rendering in view models).
4 STUDIO_DRAWTRANSLUCENTSUBMODELSThe current render is for translucent renderables only.
8 STUDIO_TWOPASSThe current render is for both opaque and translucent renderables.
16 STUDIO_STATIC_LIGHTINGUses precomputed/static lighting instead of dynamic lighting.
32 STUDIO_WIREFRAME Renders the model in wireframe mode.
64 STUDIO_ITEM_BLINK Enables blinking/item highlight effect.
128 STUDIO_NOSHADOWSPrevents the model from casting or receiving shadows.
256 STUDIO_WIREFRAME_VCOLLIDERenders the vcollide/collision mesh in wireframe mode.
1024 STUDIO_SKIP_FLEXESDo not update/apply flexes.
16777216 STUDIO_GENERATE_STATSNot a studio flag, but used to flag when we want studio stats.
134217728 STUDIO_SSAODEPTHTEXTURENot a studio flag, but used to flag model as using SSAO depth material override.
268435456 STUDIO_SKIP_DECALSDo not render decals.
1073741824 STUDIO_SHADOWDEPTHTEXTURENot a studio flag, but used to flag model as using shadow depth material override.
2147483648 STUDIO_TRANSPARENCYNot a studio flag, but used to flag model as a non-sorting brush model.

#Hook.type

"provide" | "peek" | "observe" | "mixin"

#HTMLNode.Selector

HTMLNode.SelectorCompound[][]

#HTMLNode.Value

string | HTMLNode

#http.ContentType

The media type of a request body, sent as the Content-Type header.

ValueDescription
"text/plain; charset=utf-8"
"text/html; charset=utf-8"
"text/css; charset=utf-8"
"text/csv; charset=utf-8"
"text/javascript; charset=utf-8"
"application/json; charset=utf-8"
"application/xml; charset=utf-8"
"application/x-www-form-urlencoded"
"multipart/form-data"
"application/yaml; charset=utf-8"
"application/octet-stream"
"application/pdf"
"application/zip"
"application/x-pem-file"
"application/jwt"
"application/vnd.api+json; charset=utf-8"
"image/png"
"image/jpeg"
"image/gif"
"audio/mpeg"
"audio/ogg"
"video/mp4"
"video/webm"
string

#http.Parameters

table<string, string>

The key-value parameters of a request, sent in the URL query or as a form body.

#http.RequestHeader

Well-known request header names.

ValueDescription
"Host"The domain name of the server and the TCP port number (mandatory in HTTP/1.1).
"User-Agent"Identifies the client application, operating system, and browser vendor.
"Authorization"Contains the credentials or tokens needed to authenticate a client with a server.
"Accept"Informs the server about the types of media/data formats the client can process (e.g., text/html, application/json).
"Accept-Language"Tells the server which language preferences the client has.
"Accept-Encoding"Details the data compression algorithms (like gzip or deflate) the client supports.
"Cookie"Sends stored HTTP cookies previously delivered by the server via Set-Cookie.
"Referer"Contains the address of the previous web page from which a link to the current page was followed.
"Content-Type"Indicates the media type of the request body (e.g., application/json; charset=UTF-8).
"Content-Length"Indicates the size of the request body in bytes.
"Content-Encoding"Used to determine what compression algorithm has been applied to the request body.
"Content-Language"Describes the intended natural language(s) for the audience of the request body.
"Cache-Control"Directives for caching mechanisms (e.g., no-cache, max-age=3600).
"Connection"Controls whether the network connection stays open after the current transaction finishes (e.g., keep-alive).
string

#http.RequestHeaders

table<http.RequestHeader, string>

The key-value table of request headers.

#http.RequestMethod

The HTTP request method.

ValueDescription
"HEAD"Same as GET, but only retrieves headers (no body).
"GET"Retrieve data from a server.
"POST"Send data to the server to create a resource.
"PUT"Replace a resource entirely at the given URL.
"PATCH"Partially update a resource.
"DELETE"Remove a resource from the server.
"OPTIONS"Describe communication options for the target resource.

#http.RequestURL

The URL of a request as a string.

ValueDescription
"http://"Default protocol.
"https://"Default secure protocol.
stringAbsolute URL as a string.

#http.ResponseCode

The HTTP response status code.

ValueDescription
100continue
101switching protocols
102processing
103early hints
200ok / success
201created
202accepted
203non-authoritative information
204no content
205reset content
206partial content
207multi-status
208already reported
226im used
300multiple choices
301moved permanently
302found (temporary redirect)
303see other
304not modified
305use proxy (deprecated)
306unused (reserved)
307temporary redirect
308permanent redirect
400bad request
401unauthorized
402payment required
403forbidden
404not found
405method not allowed
406not acceptable
407proxy authentication required
408request timeout
409conflict
410gone
411length required
412precondition failed
413content too large
414uri too long
415unsupported media type
416range not satisfiable
417expectation failed
418i'm a teapot (joke, reserved)
421misdirected request
422unprocessable content
423locked
424failed dependency
425too early
426upgrade required
428precondition required
429too many requests
431request header fields too large
451unavailable for legal reasons
500internal server error
501not implemented
502bad gateway
503service unavailable
504gateway timeout
505http version not supported
506variant also negotiates
507insufficient storage
508loop detected
510not extended (obsoleted)
511network authentication required

#http.ResponseHeader

Well-known response header names, always lowercase.

ValueDescription
"server"Contains information about the software used by the originating server to handle the request.
"set-cookie"Used to send cookies from the server to the client so the client can store them.
"location"Used during redirections to indicate the URL the client should visit next.
"www-authenticate"Defines the authentication method that should be used to gain access to a resource.
"retry-after"Tells the client how long to wait before making another request (often used with 503 or 429 status codes).
"content-type"Indicates the original media type of the resource (e.g., application/json; charset=UTF-8).
"content-length"Indicates the size of the message body sent to the recipient in bytes.
"content-encoding"Used to determine what compression algorithm has been applied to the payload.
"content-language"Describes the intended natural language(s) for the audience of the enclosed body.
"content-security-policy"Restricts the resources (like JavaScript, CSS, Images) that the browser is allowed to load for a given page.
"strict-transport-security"Forces the browser to communicate with the server exclusively over secure HTTPS.
"x-content-type-options"Setting this to nosniff prevents browsers from MIME-sniffing away from the declared content-type.
"transfer-encoding"Specifies the form of encoding used to safely transfer the payload.
"cache-control"Directives for caching mechanisms (e.g., no-cache, max-age=3600).
"etag"A unique identifier for a specific version of a resource, used to make caching more efficient.
"connection"Controls whether the network connection stays open after the current transaction finishes (e.g., keep-alive).
string

#http.ResponseHeaders

table<http.ResponseHeader, string>

The key-value table of response headers.

#http.Server.ErrorHandler

fun( request: http.Server.Request, response: http.Server.Response, err: any )

#http.Server.Handler

fun( request: http.Server.Request, response: http.Server.Response ): ( boolean | Future | nil )
integer

An IPv4 address stored as an unsigned 32-bit integer in host order, e.g. 127.0.0.1 is 0x7F000001.

#IPv4.Class

"A" | "B" | "C" | "D" | "E"

The classful network class of an IPv4 address, see Classful network.

#json.Array

json.Value[]

A JSON array, a sequence of JSON values.

#json.Object

table<string, json.Value>

A JSON object, string keys mapped to JSON values.

#json.Primitive

string | number | boolean | null | nil

A JSON primitive: string, number, boolean or null.

#json.Table

json.Object | json.Array

A JSON document root, an object or an array.

#json.Value

json.Primitive | json.Array | json.Object

Any valid JSON value.

#lua.ast.BinaryOperator

"or" | "and" | "<" | ">" | "<=" | ">=" | "~=" | "==" | ".." | "+" | "-" | "*" | "/" | "%" | "^"

#lua.ast.Expression

#lua.ast.Statement

#lua.ast.UnaryOperator

"not" | "-" | "#"

#Material.Shader.name

string
ValueDescription
"accumbuff5sample"
"Aftershock_dx9"
"Bik"
"Bik_dx80"
"Bik_dx81"
"Bloom"
"BlurFilterX"
"BlurFilterX_DX80"
"BlurFilterY"
"BlurFilterY_DX80"
"BufferClearObeyStencil_DX8"
"BufferClearObeyStencil_DX9"
"Cable_DX8"
"Cable_DX9"
"Cloak_DX90"
"ColorCorrection"
"Core_DX80"
"Core_DX90"
"DebugDrawEnvmapMask"
"DebugMorphAccumulator"
"DebugMRTTexture"
"DebugNormalMap"
"DebugTextureView_dx9"
"DecalBaseTimesLightmapAlphaBlendSelfIllum_DX8"
"DecalBaseTimesLightmapAlphaBlendSelfIllum_DX9"
"DecalModulate_dx9"
"DepthWrite" Used for writting depth buffer — render.GetResolvedFullFrameDepth.
"Downsample"
"Downsample_nohdr"
"Downsample_nohdr_DX80"
"Engine_Post_dx9"
"EyeGlint_dx9"
"EyeRefract_dx9"
"Eyes_dx6"
"Eyes_dx8"
"Eyes_dx9"
"Fillrate"
"floatcombine"
"floatcombine_autoexpose"
"floattoscreen"
"floattoscreen_vanilla"
"GooInGlass"
"HDRCombineTo16Bit"
"HDRSelectRange"
"hsl_filmgrain_pass1"
"hsl_filmgrain_pass2"
"HSV"
"IntroScreenSpaceEffect"
"IntroScreenSpaceEffect_dx80"
"LightmappedGeneric" The shader used for world brushes.
"LightmappedGeneric_Decal"
"LightmappedGeneric_DX8"
"LightmappedReflective" Used for reflective surfaces such as wet floor.
"LightmappedReflective_DX90"
"Modulate"
"Modulate_DX8"
"Modulate_DX9"
"MorphAccumulate_DX9"
"MorphWeight_DX9"
"MotionBlur_dx9"
"Occlusion_DX8"
"Occlusion_DX9"
"Overlay_Fit"
"Portal_DX60"
"Portal_DX80"
"Portal_DX90"
"PortalRefract_dx8"
"PortalRefract_dx9"
"PortalStaticOverlay"
"PortalStaticOverlay"
"PortalStaticOverlay_DX60"
"Predator_DX80"
"Refract"
"Refract_DX80"
"Refract_DX90"
"Sample4x4"
"Sample4x4_Blend"
"screenspace_general" Wrapper for providing custom pixel (and in some games vector) shaders.
"screenspace_general_dx8"
"screenspace_general_dx9"
"sfm_blurfilterx_shader"
"sfm_blurfiltery_shader"
"sfm_downsample_shader"
"sfm_integercombine_shader"
"Shadow"
"Shadow_DX8"
"ShadowBuild_DX8"
"ShadowBuild_DX9"
"ShadowModel_DX8"
"ShadowModel_DX9"
"ShatteredGlass"
"ShatteredGlass_DX8"
"showz" Depth buffer debugger.
"Sky_DX9"
"Sky_HDR_DX9"
"Sprite_DX8"
"Sprite_DX9"
"Spritecard"
"Spritecard_DX8"
"Teeth_DX6"
"Teeth_DX8"
"Teeth_DX9"
"TreeLeaf"
"UnlitGeneric" The shader used for GUI materials.
"UnlitGeneric_DX8"
"UnlitTwoTexture_DX8"
"UnlitTwoTexture_DX9"
"VertexLitGeneric" The shader used for models.
"VertexLitGeneric_DX8"
"VolumeClouds_dx9"
"VortWarp_dx8"
"VortWarp_DX9"
"Water_DX81"
"Water_DX90"
"WindowImposter_DX80"
"WindowImposter_DX90"
"Wireframe_DX8"
"Wireframe_DX9"
"WorldTwoTextureBlend"
"WorldTwoTextureBlend_DX8"
"WorldVertexAlpha_DX8"
"WorldVertexTransition_DX8"
"WorldVertexTransition_DX9"
"WriteStencil_DX8"
"WriteStencil_DX9"
"WriteZ_DX8"
"WriteZ_DX9"
"YUV"

#MaterialParameters

ValueDescription
1Makes the created material a VertexLitGeneric, so it can be applied to models. Default shader is UnlitGeneric.
2Sets the $nocull to 1 in the created material.
4Sets the $alphatest to 1 in the created material instead of $vertexalpha being set to 1.
8Generates Mipmaps for the imported texture, or sets No Level Of Detail and No Mipmaps if unset. This adjusts the material's dimensions to a power of 2.
16Makes the image able to tile when used with non standard UV maps. Sets the CLAMPS and CLAMPT flags if unset.
32If set does nothing, if unset - enables Point Sampling (Texture Filtering) on the material as well as adds the No Level Of Detail flag to it.
64If set, the material will be given $ignorez flag, which is necessary for some rendering operations, such as render targets and 3d2d rendering.

#Message.FinishFn

fun( message: Message, success: boolean, target: garrysmod.Player | Message.Realm )

Called when an outgoing message is finished.

success is true when the last packet is handed to the engine, the delivery is not confirmed, false if it was aborted or the target player left.

#Message.Realm

"server" | "client" | "menu"

The Lua state a message is sent from or to.

#Message.ReceiveFn

fun( message: Message, reader: BinaryReader, sender: garrysmod.Player | nil, realm: Message.Realm )

Called when a message is fully received.

sender is the player on the server and nil on the client and menu, realm is the realm the message claims to come from.

#Network.FinishFn

fun( network: Network, success: boolean, peer: garrysmod.Player | nil )

Called when an outgoing transmission is finished.

success is false if it was rejected, cancelled, timed out or the peer left.

#Network.ProgressFn

fun( network: Network, peer: garrysmod.Player | nil, is_outgoing: boolean, done_bytes: integer, total_bytes: integer )

Called on every transfer progress, both incoming and outgoing.

peer is the other side, the player on the server and nil on the client, is_outgoing is true for sent data, done_bytes counts the received or acknowledged bytes out of total_bytes.

#Network.ReceiveFn

fun( network: Network, reader: BinaryReader, sender: garrysmod.Player | nil )

Called when a message is fully received and its checksum matches.

sender is the player on the server and nil on the client.

#Network.StreamFn

fun( network: Network, sender: garrysmod.Player | nil, chunk: string | nil, offset: integer, total: integer, success: boolean | nil )

Called for every chunk of incoming data in order, while it arrives.

chunk is the data at the zero-based byte offset out of total bytes. The last call has chunk = nil and success, offset is the number of delivered bytes then.

#Object.__init

fun( obj: Object, ...: any? )

#server.Region

ValueDescription
"us-east"
"us-west"
"south-america"
"europe"
"asia"
"australia"
"middle-east"
"africa"
"world"

#sqlite.ColumnType

ValueDescription
"string"Kept as is.
"number"Converted with tonumber, nil if it is not a number.
"boolean"true for any value except "0".
"blob"Decoded from base16, select the column as hex( column ).

#sqlite.ObjectType

The type of a schema object, as stored in the type column of sqlite_master.

ValueDescription
"table"A table, created with CREATE TABLE.
"index"An index, created with CREATE INDEX or implicitly by UNIQUE / PRIMARY KEY constraints.
"view"A view, created with CREATE VIEW.
"trigger"A trigger, created with CREATE TRIGGER.

#sqlite.Query

ValueDescription
"SELECT"
"INSERT"
"UPDATE"
"DELETE"
"CREATE"
"ALTER"
"DROP"
"BEGIN"
"COMMIT"
"ROLLBACK"
"PRAGMA"
"REPLACE"
"WITH"
string

#sqlite.QueryRow

table<string, sqlite.QueryValue>

#sqlite.QueryValue

boolean | integer | number | string | sqlite.Blob | null

#steam.EWorkshopFileType

"item" | "microtransaction" | "collection" | "artwork" | "video" | "screenshot" | "game" | "software" | "concept" | "web_guide" | "integrated_guide" | "merch" | "controller_binding" | "steamworks_access_invite" | "steam_video" | "game_managed_item"

#steam.IdentifierType

ValueDescription
"Invalid"
"Individual"
"Multiseat"
"GameServer"
"AnonGameServer"
"Pending"
"ContentServer"
"Clan"
"Chat"
"ConsoleUser"
"AnonUser"

#steam.IdentifierUniverse

ValueDescription
"Invalid"
"Public"
"Beta"
"Internal"
"Dev"
"RC"

#steam.workshop.Item.AddonTag

"fun" | "roleplay" | "scenic" | "movie" | "realism" | "cartoon" | "water" | "comic" | "build"

The Steam Workshop addon tag.

#steam.workshop.Item.ContentType

"addon" | "save" | "dupe" | "demo"

The Steam Workshop publication content type.

#steam.workshop.Item.DupeTag

"buildings" | "machines" | "posed" | "scenes" | "vehicles" | "other"

The Steam Workshop dupe tag.

#steam.workshop.Item.SaveTag

"buildings" | "courses" | "machines" | "scenes" | "other"

The Steam Workshop save tag.

#steam.workshop.Item.SearchType

"friendfavorite" | "subscribed" | "friends" | "favorite" | "trending" | "popular" | "latest" | "mine"

The Steam Workshop search type.

#steam.workshop.Item.Tag

steam.workshop.Item.ContentType | steam.workshop.Item.Type | steam.workshop.Item.AddonTag | steam.workshop.Item.DupeTag | steam.workshop.Item.SaveTag

The Steam Workshop tag.

#steam.workshop.Item.Type

"gamemode" | "map" | "weapon" | "vehicle" | "npc" | "entity" | "tool" | "effects" | "model" | "servercontent"

The Steam Workshop publication type.

#steam.workshop.Visibility

"public" | "friends-only" | "private" | "unlisted" | "developer-only" | "unknown"

Visibility of a Steam Workshop item.

#steam.workshop.Warning

"general_mature" | "gore" | "suggestive" | "nudity" | "adult_only"

The Steam Workshop content descriptor.

#string.DifferenceType

ValueDescription
0String equal target one
1String inserted in target
2String removed from target

#Tar.FileType

"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | string

The type of the tar entry.

  • "0" - regular file
  • "1" - hard link to link
  • "2" - symbolic link to link
  • "3" - character device
  • "4" - block device
  • "5" - directory
  • "6" - FIFO
  • "7" - contiguous file

#time.DurationString

ValueDescription
"1ms 1us 1ns" One millisecond, one microsecond and one nanosecond.
"1h 1m 1s" One hour, one minute and one second.
"1y 1w 1d" One year, one week and one day.
"1w 1d" One week and one day.
"1y" One year.
string

#time.Unit

ValueDescription
"ns" Nanoseconds
"us" Microseconds
"ms" Milliseconds
"s" Seconds
"m" Minutes
"h" Hours
"d" Days
"w" Weeks
"mo" Months
"y" Years

#Timer.state

ValueDescription
`0`Timer stopped.
`1`Timer paused.
`2`Timer running.

#unicode.EscapeStyle

ValueDescription
"json"\uXXXX, supplementary code points are written as surrogate pairs \uXXXX\uXXXX (JSON, JavaScript, Java, C#).
"es6"\u{X} for every code point (JavaScript ES6+, Lua 5.3+, Rust, Swift).
"python"\uXXXX, supplementary code points are written as \UXXXXXXXX (Python, C, C++).

#unit.Measure

Physical quantity kind used by unit.

Conversion is only allowed between units that share the same measure; crossing measures (for example mass → volume) raises ValueError.

ValueDescription
"length"Distance, including CSS reference lengths at 96 DPI (px, pt, pc, q).
"mass"Mass / weight.
"volume"Volume / capacity.
"area"Surface area.
"temperature"Thermodynamic temperature (C / K / F / R).
"time"Duration.
"angle"Plane angle.
"speed"Linear speed / velocity.
"digital"Digital information size (SI bit/byte and IEC bit/byte).

#unit.System

string

Unit system name within a measure.

Examples: "metric", "imperial", "SI", "bit", "byte", "IECBit", "IECByte". Cross-system conversion uses per-measure anchor ratios or transforms.

#unit.Type

Unit abbreviations registered in unit (convert-units style).

Live viewport lengths (vmin, vw, …) are not part of this library; resolve those with ViewportLayout.

ValueDescription
Length — metric (anchor: meter)
"nm"Nanometer.
"um"Micrometer; ASCII alias of μm.
"μm"Micrometer.
"mm"Millimeter.
"cm"Centimeter.
"dm"Decimeter.
"m"Meter.
"km"Kilometer.
"q"Quarter-millimeter (0.25 mm / CSS q).
"pc"Pica (1/6 in at 96 DPI).
"pt"Point (1/72 in at 96 DPI).
"px"CSS reference pixel (1/96 in).
Length — imperial (anchor: foot)
"mil"Thou; 1/1000 inch.
"in"Inch.
"yd"Yard.
"ft-us"US survey foot.
"ft"International foot.
"fathom"Fathom.
"mi"Statute mile.
"nMi"Nautical mile.
Mass — metric (anchor: gram)
"mcg"Microgram.
"mg"Milligram.
"g"Gram.
"kg"Kilogram.
"mt"Metric tonne.
Mass — imperial (anchor: pound)
"oz"Ounce.
"lb"Pound.
"st"Stone.
"t"US short ton.
Volume — metric (anchor: litre)
"mm3"Cubic millimeter.
"cm3"Cubic centimeter.
"dm3"Cubic decimeter (equal to 1 litre).
"ml"Millilitre.
"cl"Centilitre.
"dl"Decilitre.
"l"Litre.
"kl"Kilolitre.
"Ml"Megalitre.
"Gl"Gigalitre.
"m3"Cubic meter.
"km3"Cubic kilometer.
"krm"Swedish kryddmått (1 ml).
"tsk"Swedish tesked (5 ml).
"msk"Swedish matsked (15 ml).
"kkp"Swedish kaffekopp (150 ml).
"glas"Swedish glas (200 ml).
"kanna"Swedish kanna (2.617 l).
Volume — imperial (anchor: fluid ounce)
"tsp"Teaspoon.
"Tbs"Tablespoon.
"in3"Cubic inch.
"fl-oz"US fluid ounce.
"cup"US cup.
"pnt"US pint.
"qt"US quart.
"gal"US gallon.
"ft3"Cubic foot.
"yd3"Cubic yard.
Area — metric (anchor: square meter)
"nm2"Square nanometer.
"um2"Square micrometer; ASCII alias of μm2.
"μm2"Square micrometer.
"mm2"Square millimeter.
"cm2"Square centimeter.
"dm2"Square decimeter.
"m2"Square meter.
"a"Are (100 m²).
"ha"Hectare.
"km2"Square kilometer.
Area — imperial (anchor: square foot)
"in2"Square inch.
"yd2"Square yard.
"ft2"Square foot.
"ac"Acre.
"mi2"Square mile.
Temperature — metric
"C"Degree Celsius.
"K"Kelvin.
Temperature — imperial
"F"Degree Fahrenheit.
"R"Degree Rankine.
Time — SI (anchor: second)
"ns"Nanosecond.
"mu"Microsecond.
"ms"Millisecond.
"s"Second.
"min"Minute.
"h"Hour.
"d"Day.
"week"Week.
"month"Mean Gregorian month (year / 12).
"year"Mean Gregorian year (365.25 days).
"decade"Ten years.
"century"One hundred years.
Angle — SI (anchor: degree)
"rad"Radian.
"deg"Degree.
"grad"Gradian.
"arcmin"Arcminute.
"arcsec"Arcsecond.
Speed — metric (anchor: km/h)
"m/s"Metre per second.
"km/h"Kilometre per hour.
"mm/h"Millimeter per hour.
Speed — imperial (anchor: mph)
"mph"Mile per hour.
"knot"Nautical mile per hour.
"ft/s"Foot per second.
"ft/min"Foot per minute.
"in/h"Inch per hour.
Digital — SI bit (anchor: bit)
"bit"Bit.
"kb"Kilobit (10^3 bits).
"Mb"Megabit (10^6 bits).
"Gb"Gigabit (10^9 bits).
"Tb"Terabit (10^12 bits).
Digital — SI byte (anchor: byte)
"byte"Byte (8 bits).
"kB"Kilobyte (10^3 bytes).
"MB"Megabyte (10^6 bytes).
"GB"Gigabyte (10^9 bytes).
"TB"Terabyte (10^12 bytes).
Digital — IEC bit (anchor: kibibit)
"Kib"Kibibit (2^10 bits).
"Mib"Mebibit (2^20 bits).
"Gib"Gibibit (2^30 bits).
"Tib"Tebibit (2^40 bits).
Digital — IEC byte (anchor: kibibyte)
"KiB"Kibibyte (2^10 bytes).
"MiB"Mebibyte (2^20 bytes).
"GiB"Gibibyte (2^30 bytes).
"TiB"Tebibyte (2^40 bytes).

#utf16.ErrorCode

ValueDescription
1Unexpected end of string (odd number of bytes).
2Unpaired high surrogate.
3Unpaired low surrogate.
4UTF-16 surrogate code point.
5Code point exceeds U+10FFFF.
6Not a valid code point (negative).

#utf32.ErrorCode

ValueDescription
1Unexpected end of string (length is not a multiple of 4).
2UTF-16 surrogate code point.
3Code point exceeds U+10FFFF.
4Not a valid code point (negative).

#utf8.ErrorCode

ValueDescription
1Unexpected end of string.
2Unexpected continuation byte.
3Invalid lead byte.
4Invalid continuation byte.
5Overlong encoding.
6UTF-16 surrogate code point.
7Code point exceeds U+10FFFF.
8Not a valid code point (negative).

#Version.Comparator

{ [1]: string, [2]: integer, [3]: integer, [4]: integer, [5]: string }

#ViewportUnit

Display length abbreviations resolved by ViewportLayout into floored CSS pixels.

Viewport units (vmin, vw, …) track window size. Absolute lengths (cm, pt, …) use the CSS 96 DPI reference, not live DPI.

For non-display unit conversion (mass, temperature, …) use unit.

ValueDescription
"px"Absolute pixels (identity).
"vmin"1% of min(window.width, window.height).
"vmax"1% of max(window.width, window.height).
"vw"1% of window.width.
"vh"1% of window.height.
"pw"Alias of vw.
"ph"Alias of vh.
"p"Mean of 1% width and 1% height ((width + height) * 0.005).
"pmin"Alias of vmin.
"pmax"Alias of vmax.
"cm"Centimeters at 96 DPI (96 / 2.54 px).
"mm"Millimeters at 96 DPI (96 / 25.4 px).
"in"Inches at 96 DPI (96 px).
"pc"Picas at 96 DPI (16 px; 1/6 in).
"pt"Points at 96 DPI (96 / 72 px; 1/72 in).
"q"Quarter-millimeters at 96 DPI (96 / 101.6 px).

#WASM.Decoder

fun( values: any[] ): any

#WASM.Import

fun( ...: any ) | string

Lua side of an import: a Lua function (fire-and-forget, JS receives undefined) or a JavaScript expression evaluated in the page (function, WebAssembly.Memory, WebAssembly.Global, ...).

#WASM.Imports

table<string, table<string, WASM.Import>>

#WASM.ValueType

ValueDescription
"i32"
"i64"Arrives in Lua as BigInteger; accepts BigInteger, integers or decimal strings.
"f32"
"f64"
"v128"Not callable from JavaScript.
"funcref"
"externref"

#WebClient.BeginHandler

fun( client: WebClient, url: string )

#WebClient.ConsoleHandler

fun( client: WebClient, msg: ( string | nil ), file_name: ( string | nil ), line_nr: ( number | nil ), severity: ( string | nil ) )

#WebClient.DestroyHandler

fun( client: WebClient )

#WebClient.Event

ValueDescription
"ready"DOM is ready; safe to run JS immediately.
"load"Document finished loading (resources may still settle).
"begin"Navigation / load started.
"console"console.* from the page.
"title"Document title changed.
"url"Address bar / location changed.
"message"Default bridge: dreamwork.message( channel, payload ) from JS.
"destroy"Panel was closed or removed.

#WebClient.JSCallback

fun( ...: any ): any

#WebClient.LoadHandler

fun( client: WebClient, url: string )

#WebClient.MessageHandler

fun( client: WebClient, channel: ( string | nil ), payload: ( string | nil ) )

#WebClient.ReadyHandler

fun( client: WebClient, url: string )

#WebClient.Status

ValueDescription
"closed"Panel destroyed or never created.
"loading"Document is loading / not ready for JS yet.
"ready"Document ready; :run executes immediately.

#WebClient.TitleHandler

fun( client: WebClient, title: ( string | nil ) )

#WebClient.UrlHandler

fun( client: WebClient, url: string )

#WebSocket.CloseHandler

fun( socket: WebSocket, reason: string | nil, code: integer | nil, errored: boolean )

Called when the connection ends.

#WebSocket.ErrorHandler

fun( socket: WebSocket, message: string )

Called when a transport / protocol error occurs.

Without any "error" handler the error is logged instead.

#WebSocket.Event

ValueDescription
"open"Handshake succeeded.
"message"A text / binary frame was received.
"close"The connection ended.
"error"A transport / protocol error occurred.
"reconnect"A reconnect attempt was scheduled.

#WebSocket.MessageHandler

fun( socket: WebSocket, message: string )

Called for every received frame.

#WebSocket.OpenHandler

fun( socket: WebSocket )

Called when the handshake succeeds.

#WebSocket.ReconnectHandler

fun( socket: WebSocket, attempt: integer, delay: number )

Called when a reconnect attempt is scheduled, delay seconds before it starts.

#WebSocket.Status

ValueDescription
"connecting"Handshake in progress.
"open"Connected, ready to send / receive.
"closing"Close requested, waiting for the peer / flush.
"closed"Not connected.

#XMLNode.Value

string | XMLNode

#Zip.Method

The compression method of the zip file (APPNOTE 6.3.10, section 4.4.5).

Only 0 (stored), 8 (deflate) and 14 (LZMA) can be read and written, the rest are listed to identify files.

ValueDescription
0Stored, no compression.
1Shrunk, LZW with partial clearing (PKZIP 1.x).
2Reduced with compression factor 1.
3Reduced with compression factor 2.
4Reduced with compression factor 3.
5Reduced with compression factor 4.
6Imploded, sliding dictionary with Shannon-Fano trees.
7Reserved for the tokenizing compression algorithm.
8Deflated.
9Enhanced deflate (deflate64), a 64 KiB window.
10PKWARE Data Compression Library imploding (old IBM TERSE).
12BZIP2.
14LZMA (EFS).
16IBM z/OS CMPSC.
18IBM TERSE (new).
19IBM LZ77 z Architecture (PFS).
20Zstandard, deprecated code, 93 is used now.
93Zstandard.
94MP3.
95XZ.
96JPEG variant (WinZip).
97WavPack.
98PPMd version I, revision 1.
99WinZip AES encryption marker, the real method is in the AES extra field.
integer