Lunar (Lunar v1.0.2)
Let's get this party started!
Summary
Functions
A convenience function for copying a Lunar runtime and setting a new id
Initialize a new Lunar runtime
Load Lua code into state from file.
Load a Lunar.Library into state.
Evaluate Lua code within a given Lunar
Encodes an Elixir value and makes it available at the key/path.
Types
Functions
clone(lunar)
A convenience function for copying a Lunar runtime and setting a new id
get_variable(lunar, key)
init()
@spec init() :: t()
Initialize a new Lunar runtime
load_lua!(lunar, path)
Load Lua code into state from file.
load_module!(lunar, module)
@spec load_module!(t(), Lunar.Library.t()) :: t()
Load a Lunar.Library into state.
Examples
iex> lunar = Lunar.init() iex> lunar = Lunar.load_module!(lunar, Math)
run(lunar, lua)
Evaluate Lua code within a given Lunar
Examples
iex> lunar = Lunar.init() iex> lunar = Lunar.load_module!(lunar, Math) iex> {:ok, lunar} = Lunar.set_variable(lunar, a, 1) iex> {:ok, [10], _lunar} = Lunar.run(lunar, "return Math.add(a, 9)")
set_variable(lunar, key, value)
Encodes an Elixir value and makes it available at the key/path.
Examples
iex> lunar = Lunar.init() iex> lunar = Lunar.set_variable(lunar, "a", 1)