Page 2 of 2

Re: Lua Tutorials

Posted: Tue Jan 05, 2010 4:21 am
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

Re: Lua Tutorials

Posted: Tue Jan 05, 2010 4:51 am
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. :)

Re: Lua Tutorials

Posted: Tue Jan 05, 2010 4:06 pm
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.

Re: Lua Tutorials

Posted: Thu Jan 07, 2010 11:42 pm
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).

Re: Lua Tutorials

Posted: Fri Jan 08, 2010 8:37 am
by kikito
Can you upload your a .love file with your current code? Otherwise it is very difficult to guess what is wrong.

Re: Lua Tutorials

Posted: Fri Jan 08, 2010 1:45 pm
by bartbes
I think the code still draws from center (as 0.5.0 did), it would explain it.

Re: Lua Tutorials

Posted: Fri Jan 08, 2010 7:53 pm
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)

Re: Lua Tutorials

Posted: Fri Jan 08, 2010 8:03 pm
by bartbes
Well, after looking at the code it looks like it already corrects for it..