openskills.info
Lua Fundamentals logo

Lua Fundamentals

Lua is a small, fast scripting language designed to be embedded inside larger applications, from video games to network servers. Instead of running programs on its own, it usually acts as the configuration and extension layer that a host program calls into.

itProgramming languages

Lua Fundamentals

Lua is a dynamically typed scripting language designed at PUC-Rio, the Pontifical Catholic University of Rio de Janeiro, with development starting in 1993. It is small, fast, and built from the start to be embedded inside a host application written in C or another language. You rarely run a bare Lua program the way you run a Python script; more often, a game engine, a proxy server, or a text editor loads Lua as its scripting layer and calls into it.

That embedding design shapes everything else about the language. Lua has a tiny core, a simple C API for the host to call Lua and for Lua to call back into the host, and a small standard library. Features that other languages bake in — classes, modules, exceptions — Lua builds instead from a few general mechanisms: tables and metatables. Learn those two well and most of the rest follows.

Values and types

Every Lua value has one of eight types: nil, boolean, number, string, function, userdata, thread, and table. nil means "no useful value here." number covers both integers and floating-point values as two subtypes of the same type, a distinction Lua has kept explicit since Lua 5.3. userdata is how the host application exposes its own C data structures to Lua code. thread is the type of a coroutine, not an operating-system thread.

This section is part of the paid course.

See pricing to subscribe, or log in if you already have access.