View Single Post
04-18-09, 01:39 AM   #31
Pytlask
A Defias Bandit
 
Pytlask's Avatar
Join Date: Apr 2009
Posts: 2
Originally Posted by Azul View Post
I'm really starting to hate lua with a passion. To bad there are no alternatives.
What programming languages have you used previously? We may be able to provide parallels to make this easier for you to understand.

As far as I know though, all of the popular ones use a similar scoping mechanism to Lua. The primary difference is that most languages default to local scoping while Lua defaults to global scoping.

The following are essentially equivalent:

Lua:
Code:
do
	local varName = 1;
end
C/C++:
Code:
do {
	int varName = 1;
}
Python:
Code:
def aFunc ():
	varName = 1
It seems to me that you are confusing the Lua "local" keyword with the C/C++ "static" keyword.

Edit: If you need 60 local variables, you are doing something wrong. Is there a reason you can't just show us the code you have right now so that we might suggest a better method?