tv-labs / lua

The most ergomonic interface to Luerl in Elixir
https://hexdocs.pm/lua/
Apache License 2.0
66 stars 0 forks source link

Add support for Lua chunks #36

Closed davydog187 closed 3 weeks ago

davydog187 commented 3 weeks ago

Adds chunk support, which allows users to precompile Lua statements and then execute them later, as opposed re-parsing and code generating at eval time. We achieve this with the following two features

  1. The ability to return chunks from the Lua sigil with the 'c' modifier
~LUA"""
print("hello world")
"""c
  1. The ability to load and evaluate chunks
{[4], _} = Lua.eval!(~LUA[return 2 + 2]c)

Closes #35