Skip to content

Lua API

The public API is grouped by ownership and purpose. Server-authoritative operations are marked Server; local presentation APIs may be available on Client.

Conventions

  • Lua arrays returned by the engine are indexed from 1.
  • Missing objects return nil; failed mutations generally return false or nil.
  • peerId = 0 refers to the local player in client-side APIs that support it.
  • Server mutations are serialized through the owning resource execution context.
  • Resource shutdown cancels scheduled and pending asynchronous work.
  • Runtime object IDs are ephemeral and must not be persisted.

Side labels

LabelMeaning
Client / ServerRegistered in both resource VM types
ClientLocal game client only
ServerDedicated or listen server authority only

Only implemented APIs are documented on this site. Proposed APIs remain in the repository roadmap until the runtime registers them.

The detailed source reference is generated from natives.md during docs startup and build so that the exhaustive implemented API list stays closer to the repository source of truth.

Lua resources for Valheim, built on a server-authoritative runtime.