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?
Lua book/tutorial
Started by Illuminated, Mar 29 2011 01:51 PM
3 replies to this topic
Sponsor:
#2 Members - Reputation: 142
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 Members - Reputation: 120
Posted 29 March 2011 - 03:57 PM
It is Lua!!LUA...LUA...LUA...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.
True but you can get near and sometimes the same performance by using LuaJIT2, more specifically FFI.Lua runs slower but takes very little time to code
#4 Moderators - Reputation: 5041
Posted 01 April 2011 - 07:56 AM
It is Lua!!LUA...LUA...LUA...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.True but you can get near and sometimes the same performance by using LuaJIT2, more specifically FFI.Lua runs slower but takes very little time to code
Hmmmm, how is it I've never seen LuaJIT before? That's pretty awesome.






