Hi. I've been interested in learning Lua for a while now and so I thought it might be handy to have a Lua wrapper for AGK. Therefore I've gone ahead and had a go at writing one. I thought other people might have a use for it too so I thought I'd share what I've got with you. You can download the current version
here.
The wrapper is basically just a modified Tier 2 template. I've currently only made templates for Windows and Android, as I don't have access to a Mac and so I can't do iOS or Mac OSX. I don't think making the port should be too difficult if you're interested though.
In the download, you'll find a few things. First off, there are are the Windows and Android templates. I've also included the SciTE IDE, modified to do syntax highlighting for the AppGameKit command set, to open the documentation and to run your programs with the AppGameKit Lua interpreter. As an extra, I've made a port of Rick's Snake Snacker game which he distributed as an AppGameKit BASIC example, so you can have a play around with that if you want to see how it works.
One major thing that I've
not included is the interpreter. The reason for that is that if I offer the interpreter as a download, then that's tantamount to just giving out the AppGameKit game engine, as anyone can then write their own games using it just by modifying the Lua scripts. Therefore if you want to use it for development, the first thing you'll have to do is to build the interpreter and put it in the correct place. There is some guidance on doing that in the documentation but if you have any trouble, do just ask.
I've also set up the templates so that (in theory) when you're ready to ship your app, you can build the lua files into the executable so that you can delete the scripts before distribution. This protects both TGC and your own source code.
To demo how extensibility works, I've added a handful of vector maths commands as well. There's lots more that I would like to add but anyhow, the foundation is there now so it should be quite easy to add new commands if you want to.
If you're wondering whether to use this, here are a few thoughts on the pros and cons.
Pros
- Lua is a more mature language than AppGameKit BASIC, and so offers greater stability and some additional structures.
- Whilst developing, there is no need to recompile anything because you are just launching the interpreter which will compile and run the scripts at run time.
- Lua is widely used in the games industry, so for those with an eye to a little CV building, it might be a useful skill to have.
- The framework is extensible, meaning that you can add your own commands in C++ whist doing most of the development from the comfort of a high level scripting language.
Cons
- You have to work with Tier 2 templates to build the interpreter and then to deploy your apps, and so you're not as shielded from such things as you are in AppGameKit BASIC.
- Only Windows and Android are currently supported out of the box.
- The wrapper is largely untested and completely unofficial. I will of course try and fix bugs that I find/are reported to me but there is nothing like the same level of guarantee as you get from using an official TGC product.
OK well that's it for now. I hope you find it useful. If you have any questions or problems with it, please just let me know.