lua-users home
lua-l archive

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


As I said in a previous message (and I am really sorry for that) I still have NO IDEA of what "tags" are ?

So, when so say "So create a tag and assign that tag to the value you are pushing in createNewObject and test that parameter 1 must
be of that tag type in setProperty." what do it implies ?

Of course I don't understand lua_newtag, lua_settag, and so on...

BTW is there somewhere a collection of LUA source examples ? 

Thanks



-----Message d'origine-----
De:	Erik Hougaard [SMTP:erik@hougaard.com]
Date:	mercredi 15 mars 2000 15:43
A:	Multiple recipients of list
Objet:	Re: LUA <--> C++ question

As I said in a previous message (and I am really sorry for that) I still have NO IDEA of what "tags" are ?

So, when so say "So create a tag and assign that tag to the value you are pushing in createNewObject and test that parameter 1 must
be of that tag type in setProperty." what do it implies ?

Of course I don't understand lua_newtag, lua_settag, and so on...

BTW is there somewhere a collection of LUA source examples ? 

Thanks


Christophe Gimenez wrote:
> 
> Hello,
> Considere the following code, do you think these is a good way (or almost
> quite right) or do you think I was lucky not to have test.exe crashing ?
> Is there a way to simplify the whole operation ?
> void setObjectProperty(void)
> {
>         lua_Object params;
> 
>         params=lua_getparam(1);
> 
>         ((myObject*)(lua_getuserdata(params)))->setProperty(lua_getnumber(lua_g
> etparam(2)));
> }

You need to use tags.. A tag can asure you that parameter 1 is of type
myObject* otherwise your code will crash if setProperty is called with a
bogus value as parameter 1. So create a tag and assign that tag to the
value you are pushing in createNewObject and test that parameter 1 must
be of that tag type in setProperty.

/Erik