Lua Tutorials

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Lua Tutorials

Post by thelinx »

nunix wrote: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. -.-
oops
Edit:
I fixed the Wiki page.
http://love2d.org/wiki/index.php?title= ... _Scrolling
User avatar
Rob
Prole
Posts: 6
Joined: Sat Dec 26, 2009 10:08 pm

Re: Lua Tutorials

Post by Rob »

osuf oboys wrote: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.
Thanks, that seems like a good idea. I've already looked at some examples and played around a bit, so, I'll take it from there. :)
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Lua Tutorials

Post by osuf oboys »

nunix wrote: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?
You can see the changes in the Wiki with the history tab. Not sure what he disliked about the previous version except that "love.system.quit()" should have been "love.event.push('q')". You are right that table-size should be returned with # from Lua 5.1 and TheLinx already fixed that. I also agree that the tutorial should not use a specific folder structure so I changed to tile0.png etc.

You have to make sure that the map is at least as wide (here, #rows) as map_display_w and as high (here, #columns) as map_display_h, and set map_w and map_h to reflect your map matrix. Otherwise, it will try to access elements that are not in the matrix.
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

Post by nunix »

I made some quicky solid color 16x16 tiles ( http://love2d.org/wiki/index.php?title=Image:Tile0.png through Tile3.png) to test the fine-scrolling tutorial with. It.. sort of works, but not quite. There's some weird padding around the top and the left side of the image. Additionally, I'm not sure what's happening with the resolution; I made a config file of both 320x240 and 240x320 and neither looked quite right (I assume the former is correct, and it looks off due to some drawing problem, but I don't know what it is).
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua Tutorials

Post by kikito »

Can you upload your a .love file with your current code? Otherwise it is very difficult to guess what is wrong.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lua Tutorials

Post by bartbes »

I think the code still draws from center (as 0.5.0 did), it would explain it.
nunix
Prole
Posts: 28
Joined: Fri Jan 30, 2009 4:38 am

Re: Lua Tutorials

Post by nunix »

kikito: the code I am using is exactly what's here.

bartbes: that was sort of my assumption but I'm still learning Lua and I can't parse the draw_map() function in the tutorial to really know how it's doing what it's doing.

Thus my request that someone take a look at the tutorial, using the sample tiles I provided, and see what needs fixin'. ;D (the tutorial's bad in that no actual tiles were initially provided, so I figured if I can't do the code yet, I could at least do the teensy grunt work of making some sample tiles)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lua Tutorials

Post by bartbes »

Well, after looking at the code it looks like it already corrects for it..
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests