## Lua Tutorials

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Rob
Prole
Posts: 6
Joined: Sat Dec 26, 2009 10:08 pm

### Lua Tutorials

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 anyone know of any particularly good ones...or should I just go buy myself a decent book instead?

Thanks

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Lua Tutorials

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.

Rob
Prole
Posts: 6
Joined: Sat Dec 26, 2009 10:08 pm

### Re: Lua Tutorials

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

nunix
Prole
Posts: 28
Joined: Fri Jan 30, 2009 4:38 am

### Re: Lua Tutorials

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.

osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

### Re: Lua Tutorials

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.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.

nunix
Prole
Posts: 28
Joined: Fri Jan 30, 2009 4:38 am

### Re: Lua Tutorials

Is the fine tile-based scrolling 0.6.0-compliant or does it need any tweaks?

thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

### Re: Lua Tutorials

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

osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

### Re: Lua Tutorials

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.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.

nunix
Prole
Posts: 28
Joined: Fri Jan 30, 2009 4:38 am

### Re: Lua Tutorials

Awesome, thanks. =D

nunix
Prole
Posts: 28
Joined: Fri Jan 30, 2009 4:38 am

### Re: Lua Tutorials

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?

### Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 11 guests