Classes with Lua

Even though Lua doesn’t have the concept of classes, we can still use tables to simulate them.  You can create tables with string to number/string/bool to represent member variables, and string to functions to represent member functions.  This would be an example of a table with some of these defined:

--This is the syntax to create a new table
Foo = {}
Foo.memberVariable = 1
function Foo.memberFunction()
  print("hi")
end

Continue reading Classes with Lua

Lua Basics

I’ve worked with a handful of scripting languages before (DCL, perl, python) but I’ve never written more than a few projects in any one.  Since you are usually doing something pretty simple with them, I typically just find a tutorial, and look up just enough to get my work done.

I’m just going to list some interesting points about the Lua language here, and if you need more information, you can search for it online.  This should be enough for you to get enough of an understanding to read basic scripts.
Continue reading Lua Basics

Interesting Links

Here are some interesting links I found while doing research on Moai:

General set of Moai tutorials to cover display, handling input  – You should definitely go through these to get an idea of how the basics work.

Moai SDK Documentation – This covers the classes and functions that are defined on them.  Note that the documentation here is incomplete – there are some classes that don’t show anything.  There is enough that this is still useful though.

Moai Code Snippits – Some utility functions that are nice to know about.

Tools that work with Moai – Links to various programs that you can use with Moai (IDE’s, drawing programs, etc)

Moai Wiki

More Moai Code Snippits – A place where people dump code snippits.  More sippits than the other link, but this website is sometimes down because it goes over its host’s limit.

Moai Forums – Official Moai forums, where a lot of questions get answered.

Here are some other tutorials that might be a good reference:

Tutorial to setup Moai for Windows and Android

Tutorial to get started with Moai

Getting setup with Moai

Installing the SDK

Moai’s website has most of what you need to get started.  You’ll need to sign up to get to the download link, which is free.  Moai is actually a few other services along with the middleware for game development.  The part you are looking for is the Moai SDK.  The other services are related to cloud services, which start free but ramp up as usage increases.  I haven’t really looked into that part of things, but it might be something to consider in the future.  Once you download the SDK, unzip it somewhere.  I ended up putting it into a subdirectory of “My Documents”, since there are a lot of .bat files in the samples directory, and Windows 8 complains if you try to run new things out of the “Program Files” directory.  In the end it shouldn’t really matter where you have it unzipped.
Continue reading Getting setup with Moai