lua-users home
lua-l archive

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



While I actually agree with you about the usefulness of a dedicated 'int' type (especially if bit operations for it were built in) I doubt the Lua authors would go this way. If they did, they would have done it already?

I would see such a type not as a split of the existing 'number' type, but an addon for especially integer operations, as you mentioned. Could this be implemented efficiently via userdata (using the pointer itself as the integer value). This would also allow binops to be added with ease.

I think I'll need to do this once LuaX goes PocketPC. I'm using 'float' there, and that won't be very int32 friendly.. Want to exchange some code on this? ;)

-ak

9.12.2004 kello 17:41, John Paquin kirjoitti:

I know that one of the main features of Lua is that it has a single variable type for numbers. There has been a lot written about the use of doubles as replacements for ints, and also about why doubles are not appropriate for many platforms (PS2, PC Games, etc).

I also know that you can change this type through the configuration (i use floats on the PC and ints on pocket PC).

However, it would be really, really nice to have a floating point type and an int type. I say this because much C code is written using bit flags. the float format can represent only about 16 sequential bit flags. while most C code (that I write anyway) uses up to 32 flags.

So the question I'm asking is, how hard would it be to make a seperate "int" data type?