Resources
Dlmp
Fields
rootElement— The whole-server root of the element tree.resourceElement— This resource as an element.resource_rootElement— Root of this resource's owned elements.event_namestring|nil— Name of the event currently being dispatched.sourceElement|nil— Source element of the current event.this_resourceElement— The resource whose callback is running.dbDlmpDb|nil— This resource's storage; present only whenresource.tomlhas[storage].
require
Loads a resource-local Lua module by name and returns its value. Names map to .lua files under the resource directory: "foo" -> foo.lua, "foo/bar" -> foo/bar.lua. The value is cached per VM, so repeated requires return the same value and run the file once. Names are case-sensitive and may use only letters, digits, _ and -, with / separating directories (no .., absolute or drive paths). Module bodies run with the SDK facade unreachable, exactly like the main script. This is not Lua's package system: no package.path, C modules or cross-resource requires.
Parameters
namestring
Returns module any
dlmp.import
Imports another resource's exports as a reload-safe proxy. Allowed only for resources listed in this resource's [server] dependencies; the returned proxy resolves each <function> lazily by name at call time, so it keeps working across a reload of the imported resource. A call into an unknown or not-running target, or a callee error, raises a Lua error (catch with pcall). Arguments and results must be plain data (no functions/userdata): handles do not cross VM boundaries, so pass ids.
Parameters
resourcestring
Returns exports table<string, fun(...):...>
