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

Hello Quote!!

Quote

Where, there is a will, there is a way.

This is just testing the new features of the new WordPress engine, where we are now allowed to set a post as “Quote”,”Image”,”Standard”, “Link” and many more like the same.

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.

Internals of this blog is updated!

Yesterday, the internals of this site is updated again. Now it runs WordPress version 3.2 Beta. This is for the first time I have updated to a development version of the engine.
Well, I must say the transition was just smooth. The best of all is it now has the new default theme and that is pretty awesome in itself. All my custom widgets are intact and I have applied them here without any hassel. Overall I am impressed with the progress of the WordPress engine and this is probably the best update in recent times.
The admin panel is sleeker and lot of confusing settings are provided in a simple UI.
Well done WordPress team. I am happy with my new design. Obviously want to listen from you, what do you think of this site.

Posted from WordPress for Android through my “HTC Wildfire”.

Got my first iOS device.

This is been a while since I was thinking of getting an iOS device. Finally I got one and this is ipod touch with retina display. That makes me excited again as to keep my developer shoes on.
my first iOS device
First of all, I must say Apple keeps an eye for a lot of detail into account while it comes to its products, any product. It has got some awesome products, but then it does not stop there. Till the product is delivered to the customer and its use, each one is specially taken care of.
my first iOS device
In my case, opening of the cover itself gave me a sense of satisfaction. The way things are packed, each thing is tightly bundled yet very easy to open up. I am completely surprised to see the small arrow mark on the stickers, which are just used for packing purpose.
my first iOS device
This gives an user satisfaction as in details in small things. Probably that’s why Apple is the best in UX ( user experience ). Once I opened my ipod touch, its amazing to see that I can straight away use the product, no charge for 6hrs before use, kind of thing. Another UX win. The samething had impressed me before also, when I got my macbook pro. After all these, the retina display and camera swing funtionality is just some nice, exciting feeling. Overall, I am impressed and thank you Apple for keep innovating and making my life pleasurable.

my first iOS device

Posted from WordPress for Android through my “HTC Wildfire”.

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.

One size fits all, does not fit.

I heard this one before, but then kind of ignored. Why?!! For I, as a web and desktop designer and developer when started iphone development it seemed, “ok, fine, lets do the design and go for development” . Iphone and any iOS in that case have a clear guideline of user interactions. So no worries, if I am sticking to those guidelines, I am sure the product will have a nice user experience. Keeping that in mind, I moved on. And then it all went well. Until I started developing for other devices and other OS such as Android.
Developing games on the other hand is not about those default navigations, one has to think of it from the gaming UI perspective. So what I think is while game design can be one design for multiple devices but the size factor does the trick. If a game is designed for 2 different mobile phones (may be different make too of same OS), it does not matter which OS they are running in, as long as the size of the device screen is kind of same, we are good to go. But then if at all there is a difference in the ratio of height and width of a device screen, the design needs some tweak to give the user a same or similar user experience.
Now, if we talk about application design for mobile, then its all together different approach. Apart from the size, one has to take into account, the platform that is running the application. This surprised me, when I was trying to port an application from iphone to android. Well, we can just port it and it will work the same way it works on iphone, but then there are different physical buttons present in Android devices (even Windows mobile phones and other OS phones), which are not present in iOS devices. The point is either we are not utilising the UI of the device or making a bad use case of the UI of the device and in turn our application, if we port one application as is to another device.
So clearly, each device will have a different design, the code base may be same, but design must be different to be useful and give the same user experience through out devices.