[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua script in games? (vectors)
- From: "Nick Trout" <nick@...>
- Date: Thu, 26 Jun 2003 20:42:39 -0700
> > It's all want, want, want with you Cuthbert! Lua doesn't have ints!
The
> > default is double, which covers floats, ints, 32bit unsigned ints
(so
> > you can do 32 bit colour). Light userdata was added to replace C
> > pointers cast to numbers and passed round inside Lua IIRC.
>
> That's me :-) actually I've compiled Lua to deal with just floats
right
> now.
>
> It sounds like this passing of C pointers to Lua is more of a hack
than my
> humble vector type ;-)
The other thing you might want to watch out for if you're on PS2 is the
llimits.h definitions. Long is 8 bytes on PS2 but the instruction length
and number type are/can be 4 bytes (why waste?) so:
/* type to ensure maximum alignment */
#ifndef LUSER_ALIGNMENT_T
typedef union { double u; void *s; long l; } L_Umaxalign;
#else
typedef LUSER_ALIGNMENT_T L_Umaxalign;
#endif
so:
#define LUSER_ALIGNMENT_T int
or change the union code... There are a few other longs in the code
that've changed to ints as well.
> Its not really speed I'm after though, its convenience.. have a read
of my
> (just posted) mail regarding the real problem implementing vectors as
a
> table.
True. You shouldn't be doing much of the AI apart from high level
control in script so it shouldn't really be an issue.
I'm afraid it's tea time now [rumble rumble]. Maybe later.
--nick