2025-06-11 22:23:49 +08:00

1.5 KiB

Lua

Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

LiveCodes runs Lua in the browser using Fengari.

Fengari (Moon in greek) is the Lua VM written in JavaScript. It uses JavaScript's garbage collector so that interoperability with the DOM is non-leaky.

fengari.io

:::info Note

LiveCodes also supports running Lua using Wasmoon which is a real Lua 5.4 VM with JS bindings made with WebAssembly. Read documentation here

:::

Usage

LiveCodes runs Lua in the browser. JavaScript interoperability and DOM access is achieved using "js" module.

import LiveCodes from '../../src/components/LiveCodes.tsx';

This example demonstrates usage, JavaScript interoperability and DOM access:

Language Info

Name

lua

Extension

.lua

Editor

script

Compiler

Fengari

Version

Fengari v0.1.4

Code Formatting

Using lua-fmt.

Starter Template

https://livecodes.io/?template=lua