lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi.

It's possible to define functions prototypes in Lua?

In the following example, I must have defined the
function "e1_func" before attrib to e1.func, or there
is some way of just declare a prototype, and later or
in another module define it:

function e1_func()
	...
end

e1.func = e1_func


By the way, is there some way of creating "real
#defines" in Lua?

If I do something like this:

ENEMY1 = 1
ENEMY2 = 2
...
ENEMY100 = 100


if enemy.type == ENEMY1 then
 ...
end

I created 100 variables, when I just needed the value
of the constant.

In C, it could be:

#define ENEMY1  1
#define ENEMY2  2
...
#define ENEMY100 100


if( enemy.type == ENEMY1){
 ...
}

better, could use a enum.


______________________________________________________________________

Yahoo! Messenger - Fale com seus amigos online. Instale agora! 
http://br.download.yahoo.com/messenger/