Caffeine

Native modules

Reference Game Last updated: Lua 2 · Dryad 0

Load and call native modules through JSON.

All namespaces

Namespace: caffeine.native

load#

Lua: caffeine.native.load

text
load(name) -> boolean

Loads a native module. The load error is not reported to the script.

ParametersTypeDescription
namestringNative module name.

Returns: boolean. True when the module loaded.

Example

lua
caffeine.native.load('mymodule')

call#

Lua: caffeine.native.call

text
call(module, fn[, argsJson]) -> string

Calls a function of a loaded native module with JSON arguments.

ParametersTypeDescription
modulestringModule name.
fnstringFunction name.
argsJsonstringJSON arguments (default "{}").

Returns: string. The result text; on failure the error message is returned instead.

Example

lua
local out = caffeine.native.call('mymodule', 'ping', '{}')