From 8b1e6e63aee2643df20167971c73fba16f11018d Mon Sep 17 00:00:00 2001 From: tocariimaa Date: Mon, 17 Feb 2025 14:54:17 -0300 Subject: [PATCH] articles/lua.md: update --- articles/lua.md | 11 +++++++++++ 1 file changed, 11 insertions(+) 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