Simple Timer - Lua Typing CST Test
Loading…
Simple Timer — Lua Code
Counts seconds and prints elapsed time.
time = 0
function updateUI()
print('Time: ' .. time .. ' sec')
end
function tick()
time = time + 1
updateUI()
end
-- Simulate actions
updateUI()
tick()
tick()Lua Language Guide
Lua is a lightweight, high-level, multi-paradigm scripting language designed for embedded use in applications. It emphasizes simplicity, portability, and performance, and is widely used in games, embedded systems, and scripting engines.
Primary Use Cases
- ▸Scripting in video games (e.g., Roblox, World of Warcraft, Angry Birds)
- ▸Embedded scripting in applications
- ▸Configuration and automation scripts
- ▸Rapid prototyping and DSLs (domain-specific languages)
- ▸Network services and lightweight servers
Notable Features
- ▸Small and lightweight runtime
- ▸Fast execution and JIT compilation (with LuaJIT)
- ▸Dynamic typing and automatic memory management
- ▸First-class functions and closures
- ▸Extensible via C API
Origin & Creator
Created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes at PUC-Rio, Brazil.
Industrial Note
Lua is specialized for embedding in applications such as video games, simulation software, and network applications, allowing host programs to expose custom APIs to Lua scripts.