Lua v5.1 is available from the maemo extras-devel repository.

1. Activate extras-devel.

In the Application Manager:

1.1 Navigate to the application menu (tap the title bar)
1.2 Select Application catalogs
1.3 Select New
1.4 Enter a catalog name of Maemo extras-devel
1.5 Enter a web address of http://repository.maemo.org/extras-devel/
1.6 Enter a distribution of fremantle (fremantle-1.2 and fremantle-1.3 now have the same content)
1.7 Enter components of free non-free
1.8 Select Save

2. Open terminal and enter the following commands.

root # needs to be root
apt-get install lua5.1