diff --git a/articles/lua.md b/articles/lua.md index f7fd615..fd63b7c 100644 --- a/articles/lua.md +++ b/articles/lua.md @@ -10,6 +10,17 @@ implementing arrays and hash tables in a single type and enabling metaprogrammin The main reference implementation is written in [ANSI C](c.md) (about 32000 LOC) and uses a register-based bytecode virtual machine for execution. Another notable implementation is [LuaJIT](https://luajit.org), which speeds up execution speed by JIT compiling the Lua code. +## Bytecode +`luac` can be used to compile and dump bytecode into a file. However the bytecode is not portable. +```sh +luac -o out source.lua +``` + +You can get a listing of the compiled bytecode for a Lua source file with `luac`: +```sh +luac -p -l -l source.lua +``` + ## Examples ### Hello world ```lua