OpenPlug : ASlate, drawing application.

While learning OpenPlug|Studio and diving into the code, my third Android application is here. Its a simple drawing board, kind of slate. As an user one has option to select different color and pen thickness for drawing on it. Again a simple but usable application, which can be downloaded from this link.
The source code is availbale at Github too.

Lua : some basics

This is an extension of my last post about Lua. If you have not read that yet, I strongly suggest start from there as a beginner of Lua. On the other hand, if you know the basics of Lua, this post is exactly for you.
Hope you enjoy Lua as I am excited about it. Lets get started.
Commenting in Lua is done by “–” for single line and with “–[[ ]]” for multiline.

-- single line comment
--[[
Multiline comment is
Like this.
]]
print("comments are done, get back to work")

Continue reading

Lua : getting started

At very basic Lua syntax is very flexible. Lua can interpret the line ending!! I am serious. For example the code below

local a=6 local b=5 print (a+b)

is exactly same as the code below

local a=6 
local b=5 
print (a+b)

That means we can go ahead writing like the code below too.

local 
a=6 local b
=5 print 
(a+b)

But then comes readability. Its generally better to write code, which we, ourselves can read later too !! So generally one statement per line is a convention.
Now for the declaration of variables, by default any variable declaration is a global variable, unless we define it as a local variable with the ‘local’ keyword as follows.

local a=1
local b='string'

If we remove ‘local’ keyword, the variables are global.
Any variable declaration can contain any kind of values, i mean its not mandatory for a variable to store one kind of values, Lua interpreter can take care of that.
For people who are used to semicolons at the end of the statement, can write that way too and Lua interpreter can take care of that too.

local a=6;
local b=5;
print (a+b);

Writing a for loop in Lua is as below

for i=0,10 do
print (i)
end

Writing a conditional statement is as below

if(a>b) then
print ('a>b')
end

Similarly the if-else would be as below

if(a>b) then
print ('a>b')
end if(a

Finally the way we load different .lua files is through 'require' as follows

require "newFile.lua"

Finally there is a way to start experimenting with Lua without even installing it. This is through the Web Lua project.

With that I think we can get started with this small but powerful language, Lua.

Lua : My experience with it.

Well, on my journey with mobile development, I picked up Lua for sometime. I am quite impressed with its simplicity and power. If you do not know, Corona SDK provides Lua scripting language to build applications for mobile devices. The popular Angrybirds game utilises the power of Lua.
Basically its a simple language with very minimum number of key words and language syntaxes. Anyone familiar with javascript or actionscript can start jumping into it and be productive from day one. There are variants of the installer for Mac and Windows. Some what I feel Windows installer is the best and has got its own IDE, which is on top of popular SciTE IDE.
There is a complete 2D game engine / framework for Lua named Love. With that one can instantly start creating Lua games. As Lua is simple, so as Love is. But then one gets a whole lot of goodies out of a framework. I would say a must try for any game developer.
There is a nice framework for iPhone, which uses Lua and its called WAX. This also fits Lua’s philosophy as to keep the framework simple and easy. The best part is, once you start coding in WAX, you do not have to think about memory management, which is very important and sometimes most time consuming act, while developing application with ObjectiveC.
Now that I have seen Lua’s power and simplicity, I will try that out more and more and post updates about my experiments. Here are some Lua related links for you to get used to
1. Users, tutorials and more
2. Love : 2D game engine
3. WAX : iOS development framework
4. 2D Engine A 2D game engine (I Have not tried yet)
5. Luxinia 3D game engine (I have not tried yet)
6. Lua Forge Projects, tutorials and more
7. Baja Engine A game engine (I have not tried yet)

With that I think I also have to pick up some engines and start playing with it. Overall, Lua feels just perfect as its simplicity and power. Its portable and lightweight. After all its Opensource and Free.

My opensource iphone game now supports accelerometer

I have made some improvements since my last post about the game. The game (Math Is Fun 2) now supports accelerometer. The new version of the game is having below mentioned additions and updations to it.

1. Accelerometer support ( The game mode is now changed by changing phone’s direction )
2. A counter is added ( Which changes question in every 1000 count )
3. Game now displays, total questions played ( asked )
4. Total number of correct answers given by user is displayed
5. Total number of wrong answers given by user is displayed

The code is on GitHub and licensed under Unlicense.