Note: This post is out of date. If you'd like to run Lua on your Android device, please see my Android Scripting Environment project.
After messing around for two days trying to get Python running on Android, I decided to give Lua a try. It didn't take much to get the interpreter running (especially compared to Python which still isn't running for me). Here's a very small patch for Lua 5.1.4.
Update
I fixed some bugs in the instructions. :)
After messing around for two days trying to get Python running on Android, I decided to give Lua a try. It didn't take much to get the interpreter running (especially compared to Python which still isn't running for me). Here's a very small patch for Lua 5.1.4.
diff -r lua-5.1.4/src/llex.c lua-5.1.4-android/src/llex.cYou'll also need get the Android source and build it. Then grab agcc (a small Perl script) linked to from some brief instructions about compiling native code for Android. Here are some even briefer instructions for getting Lua on your G1 :)
179c179
< struct lconv *cv = localeconv();
---
> //struct lconv *cv = localeconv();
181c181
< ls->decpoint = (cv ? cv->decimal_point[0] : '.');
---
> ls->decpoint = '.';//(cv ? cv->decimal_point[0] : '.');
461d460
<
diff -r lua-5.1.4/src/lvm.c lua-5.1.4-android/src/lvm.c
205c205
< int temp = strcoll(l, r);
---
> int temp = strcmp(l, r);//strcoll(l, r);
763d762
<
- Add
agcc
to your path. - Add
mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin
to your path (the Android toolchain). - Add
mydroid/out/host/linux-x86/bin
to your path (the Android development tools). - Build and install Lua.
$ make CC=agcc AR="arm-eabi-ar rcu" RANLIB=arm-eabi-ranlib posix
...
$ make INSTALL_TOP=$(pwd)/lua-android install
- Copy Lua to your phone/emulator using
adb
.
$ cd lua-androidYou can now either run Lua from
$ rm -rf man
$ adb shell
$ su
# cd data
# mkdir bin include lib share
# exit
$ exit
$ adb push . data
adb shell
or by installing the terminal emulator app and running it directly on your phone.Update
I fixed some bugs in the instructions. :)