I seam to have not used locals at all, just so I can call them from other functions. Is that a bad habit?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
How important are local variables?
its bad for memory heavy games(lots of objects)
So what's the problem with local variables? You can call them from other functions just as easily. The only situation I can think of where you can't access a local variable is when you create it inside a function/module and then try to access it outside that function/module. But creating a global inside a function is a very bad idea.
By using only globals you actually produce spaghetti code and make it harder for yourself to maintain the program as it grows in size. The more modular and independent pieces of your code are, the better.
I will attempt to use locals more then :)
Local variables make your code faster, generally.
Here's a great post on locals as well as some good comments too.
views:1550 update:2011/10/5 8:48:05
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Link to Review on NOOK - are intents required? Workarounds?
Moving objects while being affected by physics
Can't build for device
Cannot render rotated text object
Object moves on a defined path example ?
Bezier Curves, SVG Parser for Box 2D etc.
Hard crash with native elements on device?
Need help insert object
access to ipod music library
portraitUpsideDown in the simulator
Moving objects while being affected by physics
Can't build for device
Cannot render rotated text object
Object moves on a defined path example ?
Bezier Curves, SVG Parser for Box 2D etc.
Hard crash with native elements on device?
Need help insert object
access to ipod music library
portraitUpsideDown in the simulator
corona forums © 2003-2011