lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	A quick response, because I'm not so good at teaching. ;)
	When you use negative indexes, you make a relative access of the
elements of your stack. When you know how the top of the stack looks
like, it's much easier. However, if something changes the top of the
stack (such as poping a value), then you have to deal with it.
	When you use positive indexes, your access are absolute. You can change
the top of the stack, and still the indexes of your values haven't
changed. However, if you want to access a value from the top of the
stack, you have to get the index of the top first, then compute the
index of your value.

	Thomas.

P.S. I suppose your Npc is a lightuserdata?

Le 30/05/2010 12:36, Erwin Oegema a écrit :
> 
> Npc * getNpc(lua_State *luaVm);
> 
> But yea, I don't know what the differences are (other than getting values from the top with negative values)...
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwCQ0kACgkQBV7eXqefhqjHagCgsyrTdV6ORmR8DkDgCytNqXH2
kHYAnizUPXXE3Ddm0rnak9Y2Hw1YgZRa
=fU5X
-----END PGP SIGNATURE-----