I seam to have not used locals at all, just so I can call them from other functions. Is that a bad habit? [import]uid: 79135 topic_id: 14650 reply_id: 314650[/import]
its bad for memory heavy games(lots of objects) [import]uid: 16142 topic_id: 14650 reply_id: 54181[/import]
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. [import]uid: 52103 topic_id: 14650 reply_id: 54193[/import]
I will attempt to use locals more then [import]uid: 79135 topic_id: 14650 reply_id: 54194[/import]
Local variables make your code faster, generally.
Here’s a great post on locals as well as some good comments too. [import]uid: 23693 topic_id: 14650 reply_id: 54198[/import]