Skip to content

Module dev_lua_lib.erl

A module for providing AO library functions to the Lua environment.

Description

This module contains the implementation of the functions, each by the name that should be used in the ao table in the Lua environment. Every export is imported into the Lua environment.

Each function adheres closely to the Luerl calling convention, adding the appropriate node message as a third argument:

fun(Args, State, NodeMsg) -> {ResultTerms, NewState}

As Lua allows for multiple return values, each function returns a list of terms to grant to the caller. Matching the tuple convention used by AO-Core, the first term is typically the status, and the second term is the result.

Function Index

convert_as/1*Converts any as terms from Lua to their HyperBEAM equivalents.
event/3Allows Lua scripts to signal events using the HyperBEAM hosts internal event system.
get/3A wrapper for hb_ao's get functionality.
install/3Install the library into the given Lua environment.
resolve/3A wrapper function for performing AO-Core resolutions.
return/3*Helper function for returning a result from a Lua function.
set/3Wrapper for hb_ao's set functionality.

Function Details

convert_as/1 *

convert_as(Other) -> any()

Converts any as terms from Lua to their HyperBEAM equivalents.

event/3

event(X1, ExecState, Opts) -> any()

Allows Lua scripts to signal events using the HyperBEAM hosts internal event system.

get/3

get(X1, ExecState, ExecOpts) -> any()

A wrapper for hb_ao's get functionality.

install/3

install(Base, State, Opts) -> any()

Install the library into the given Lua environment.

resolve/3

resolve(Msgs, ExecState, ExecOpts) -> any()

A wrapper function for performing AO-Core resolutions. Offers both the single-message (using hb_singleton:from/1 to parse) and multiple-message (using hb_ao:resolve_many/2) variants.

return/3 *

return(Result, ExecState, Opts) -> any()

Helper function for returning a result from a Lua function.

set/3

set(X1, ExecState, ExecOpts) -> any()

Wrapper for hb_ao's set functionality.