Jump to content

  • Log In with Google      Sign In   
  • Create Account


Lua book/tutorial


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Illuminated   Members   -  Reputation: 109

Like
0Likes
Like

Posted 29 March 2011 - 01:51 PM

Hello. I need good book/tutorial about lua. I am not sure if this is the right place to post this, but hope you can help me.
So far i can bind lua function to c++ function and set variables in lua, but is this all that can be achieved with lua?

Sponsor:

#2 BuffaloJ   Members   -  Reputation: 142

Like
0Likes
Like

Posted 29 March 2011 - 03:20 PM


I view the the whole c++ vs scripting as a coding time vs performance thing. C++ runs fast but takes a while to code. Lua runs slower but takes very little time to code.

For example, if I were writing an archery game then I would write a bow class, an arrow class and a target class in C++(or at least the collision detection/physics code) to make sure the game runs fast. But suppose on one level I wanted to have the target slide left/right. This would probably take about an or so to write in C++, but in LUA I should be able to write this in 5 minutes, literally.

For me, that defines the role of LUA/scripting in my game engine. From that perspective, I keep the LUA code more limited in scope. I expose variables as you mentioned and add a tick(and others if necessary) function to the script to extend the entities behavior.


One of the goals of LUA is to be lean and mean. Runs quick and doesn't do too terribly much besides the basic language construct. This is in contrast to Python which has a ton of libraries so you can do pretty much anything. What you want out of the scripting language helps to define which you would choose.
LUA, being so small and simple, is really easy for a programmer to pickup. There aren't a ton of libraries to figure out...

I added LUA to my engine after reading an article in the Game Programming Gems series. I found the article quite informative. I don't have the book on me at the moment so I forget which edition it was in...



#3 djofdifjpodjfpodkpofdpofpd   Members   -  Reputation: 120

Like
1Likes
Like

Posted 29 March 2011 - 03:57 PM

LUA...LUA...LUA...LUA

It is Lua!!

GPG 6 & 7 both have Lua binding articles in them, where 6 is written by the Lua development team.

svetpet there is the free first edition of Programming in Lua and the second edition for 5.1 available from the Lua website.

Lua runs slower but takes very little time to code

True but you can get near and sometimes the same performance by using LuaJIT2, more specifically FFI.

#4 JTippetts   Moderators   -  Reputation: 8265

Like
0Likes
Like

Posted 01 April 2011 - 07:56 AM

LUA...LUA...LUA...LUA

It is Lua!!

GPG 6 & 7 both have Lua binding articles in them, where 6 is written by the Lua development team.

svetpet there is the free first edition of Programming in Lua and the second edition for 5.1 available from the Lua website.

Lua runs slower but takes very little time to code

True but you can get near and sometimes the same performance by using LuaJIT2, more specifically FFI.


Hmmmm, how is it I've never seen LuaJIT before? That's pretty awesome.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS