I am trying to learn Corons SDK / Lua and use it to program a small game. One of the ways I’m learning is by looking at sample code. However I get hung up on tiny questions, like syntax questions. The answers to some are harder to find than others.
For example, I was seeing this syntax for iterating through a table that does not have numerical keys, using “pairs()”. The following is from the sample code “FrameAnimation2” :
for \_,item in ipairs( params ) do
local ball = newBall( item )
collection[#collection + 1] = ball
end
It’s the underscore “_” I couldn’t find any documentation for. I’ve seen it used in other function calls too. By noodling around I figured it’s probably used when you don’t want to use that value - kind of a placeholder.
So this just a style thing? How would I have looked it up instead of having to spend so much time researching and finally having to experiment? I have a Lua book (Roberto Ierusalimschy’s), but it wasn’t in there…
Thanks [import]uid: 128346 topic_id: 23448 reply_id: 323448[/import]