Page 1 of 2

Lua Tutorials

Posted: Thu Dec 31, 2009 10:22 pm
by Rob
Hello all,

First, I apologise if this has been asked before, but I'm struggling to find decent tutorials on Lua out there, and I'm not fond of the way the 'official' one is written...even Google has failed me :o anyone know of any particularly good ones...or should I just go buy myself a decent book instead?

Thanks :)

Re: Lua Tutorials

Posted: Thu Dec 31, 2009 10:31 pm
by Robin
Welcome!

The PIL is a good place to start, and it is much more than a tutorial. After reading the PIL, you can* understand how Lua works.

* Of course, this depends... I needed a second read to understand the more complex parts, but you can ignore them if you wish.

Re: Lua Tutorials

Posted: Thu Dec 31, 2009 10:46 pm
by Rob
I have had a brief read of that...I guess I'll just go back to it and take the time go to through it properly, since it seems to be what most people learn from.

Thanks :)

Re: Lua Tutorials

Posted: Fri Jan 01, 2010 12:22 am
by nunix
There were quite a few examples written for 0.5.0, but they got lost in the upgrade.. hopefully those'll be up soon, should help quite a bit.

Re: Lua Tutorials

Posted: Sun Jan 03, 2010 4:48 pm
by osuf oboys
The wiki tutorials have now been updated to 0.6.0. These are however on LÖVE and not Lua.

I am not sure you need a tutorial on Lua though. I would recommend first looking at a working LÖVE example (like the simplest text writing tutorial) and then proceeding by going through the official Lua tutorial. You can test the things you read then by changing the text written in LÖVE (alternatively, get a Lua interpreter). After that, you could look through the list of methods of Lua and then proceed with the rest of the LÖVE tutorials and then the documentation. After you have done and understood all that, you should be a real expert.

Re: Lua Tutorials

Posted: Mon Jan 04, 2010 12:17 am
by nunix
Is the fine tile-based scrolling 0.6.0-compliant or does it need any tweaks?

Re: Lua Tutorials

Posted: Mon Jan 04, 2010 12:51 am
by thelinx
nunix wrote:Is the fine tile-based scrolling 0.6.0-compliant or does it need any tweaks?
http://love2d.org/wiki/index.php?title= ... ling_Juice

Re: Lua Tutorials

Posted: Mon Jan 04, 2010 12:54 am
by osuf oboys
nunix wrote:Is the fine tile-based scrolling 0.6.0-compliant or does it need any tweaks?
Just basic changes: adding a "love." prefix to callbacks and replacing constants with strings. Wiki article updated.

Re: Lua Tutorials

Posted: Mon Jan 04, 2010 12:56 am
by nunix
Awesome, thanks. =D

Re: Lua Tutorials

Posted: Mon Jan 04, 2010 9:37 pm
by nunix
Uh.. can you explain your changes, Thelinx? Your edit-reason was "0.6.0 is not the stable version right now"..but.. 0.6.0 sure as hell does seem to be the stable version right now. -.- Also why would you change one tutorial back to 0.5.0 but none of the others?

However, on topic!

1) is table.getn really right there? Looking through the 5.1 book, there's a note that says table.getn was a 5.0 thing, and that 5.1 uses #. There's also no mention of table.getn in the online reference manual that I can see.

2) The tutorial, as it stands, seems to crash on me. I made a couple of small changes that I THOUGHT I understood, but maybe I don't:

First I made the map smaller

Code: Select all

	--the map
		map={
	{0, 0, 0},
	{0, 2, 0},
	{0, 0, 0},
	{0, 0, 0},
	{0, 0, 0},
	{0, 1, 0},
	{0, 0, 0},
	}
Also I'm using bigger tiles, 400 x 400 so I did

Code: Select all

	tile_w = 400	
	tile_h = 400
I get a grey love screen to pop up, and then it crashes, without any real error report. Any idea what's going on?

edit: gah, it's because of the dumb tile={} thing at the start, I think. If a tutorial is going to rely on particular assets/directory/whatever, they should be included in the tutorial. -.- Anyway, it's not crashing anymore since I changed it to

Code: Select all

for i=0,2 do
and got my graphics in the right place, but now it's just a BLACK screen. what gives?