Lua for Wii

From WiiBrew
Jump to navigation Jump to search
TypePorted Libraries

Lua is a small and powerful scripting language that is perfect for use in projects that require changes in logic without the hassle of recompiling the program's source code. Lua can be told to load a file and execute functions from that file to create a dynamic program flow. Being extensible, Lua allows the programmer to define new functions for use in the script files they create.


The source code comes with a functioning example. To use the example, you need to copy the 'test.lua' to the root of your SD card, then run the lua.elf, either from Wiiload, the HBC menu, or (possibly- not tested yet) any other homebrew bootloader.

Reasons To Use Lua

To poke at a few popular uses of Lua; Lua was used in World of Warcraft for the GUI, in Farcry for the console system and all of the programmed user materials in Gmod(the famous retail HL2 sandbox mod) are made with it. It's been used in a bunch of open source game engines because it is simple to use and pretty versatile.


  • FAT system needs to be initialised by the user before calling any file loading functions (such as luaL_dofile(...)).


The only major changes to the source code were removing functions related to launching system executables and getting the system's time. Other small changes were made to the file manipulation functions- they try to initialise FAT before use but it is recommended you do this yourself! The makefile might need some configuration to reflect your development environment.