lua-users home
lua-l archive

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


On 12/13/2011 12:45 PM, Drakkor . wrote:
> You're not doing anything wrong. tolua is profoundly broken in the way that you describe. I recommend against anyone using tolua for that reason.
> Tim
 
Hi Tim, thanks for the response, I'm sorry to hear it though.  Dropping toLua completely would be a lot of work for this lazy programmer :)
 
I think I will try modifying our version of toLua to use the actual Udata block address as a key into the toLua tables instead of the address it's holding onto, at least that way we wont have collisions in the table.  I'll have to figure something else out for getting orphaned userdata out of the tolua_ubox table.

I've decided that intrusive structures (in C++) are the way to go (they can kill themselves on delete).

One thing to note is that you can have it treat uint32_t as a lua_Number. Then you won't have as MANY collisions... If you add this to your tolua spec:

typedef signed char      int8_t;
typedef unsigned char     uint8_t;
typedef short int     int16_t;
typedef unsigned short int    uint16_t;
typedef int     int32_t;
typedef unsigned int    uint32_t;

...then it will understand that all of those are really numbers. The code should be faster too.

Tim