Lua syntax best practice

I want my code to look pretty, and at the same time I want to follow the best practice. But some things just hurt my eyes, like this:

local image = display.newImage( "myimage.png" )  

The above just feels so wrong! This one looks better:

local image = display.newImage("myimage.png")  

What I’m refering to is the whitespace inside the parameter. I know both are valid, and both versions are common. But which one is the better practice in Lua? [import]uid: 13180 topic_id: 8073 reply_id: 308073[/import]

Either is fine. With things like that it is thr developers own choice and style to use either. Neither one of the two would be considered a “better practice”

Its the same as people having a space after an = sign and some not. Its all a case of personal preference [import]uid: 6981 topic_id: 8073 reply_id: 28759[/import]

What!? Not having a space after the = sign? That would be blasphemy! :wink:

Unless it’s an html attribute, that is. When I see people who insert a space there I just want to stab my eyes out. [import]uid: 13180 topic_id: 8073 reply_id: 28760[/import]

I don’t think Lua has any best practice on those sorts of details, but when I program I follow Python’s style guide with two exceptions: I indent with tabs and not spaces, and I use both camel case and underscores when naming functions (the style guide prefers the latter.)

Incidentally, the Python style guide agrees with you on that example.

For those new to some of this jargon…
camel case: thisIsTheName()
underscores: this_is_the_name()

What!? Not having a space after the = sign? That would be blasphemy!

*reading someone else’s code*

x=7+i  

AARGH [import]uid: 12108 topic_id: 8073 reply_id: 28812[/import]