lua-users home
lua-l archive

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


Hi there,

    Shortly after i had sent the message i was thinking about making the
base number type an integer, and just implementing the "decimal" values as a
user type, for the purposes of the system it will probably be some fixed
point type. i am not too sure about tables, i have not known of lua for that
long, but in time i guess i will learn more.

    i have been looking at both the 4.0.1 version and the 5.0 Beta, from
what i can see the 5.0 appears to be nicer. A few of the main points as for
why i might stick with 5.0 Beta is due to the addition of the boolean type,
and that the virtual machine is faster due to a register based design, over
the next few days i am sure i will come to a better understanding of lua and
what can be done. I will still keep the idea of 4.0.1 in the back of my
head, so if 5.0 is too much, then i will go to 4.0.1.

Cheers,

    Andrew Stanley Teirney

----- Original Message -----
From: "Asko Kauppi" <Asko.Kauppi@fi.flextronics.com>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Cc: <lua-l@tecgraf.puc-rio.br>
Sent: Thursday, February 06, 2003 2:11 AM
Subject: RE: Lua and adding types


>
> Lua itself (at least 5.0) allows the number type to be easily defined as
> either double or long. For an embedded program, I would definately change
> the native Lua type to integers. Makes the engine smaller & more efficient
> for you.
>
> To use floats for your own needs (not lua's) you could make them a
userdata
> type. This has some limitations, though, but consider it similar to
wrapping
> the complex numbers. This is alternative 1.
>
> Alternative 2 would be to not use userdata but wrap the numbers as lua
> tables instead. E.g. "nbr= { i=10, f=1234 }" or something the like. Again,
> there is an analogy to complex numbers.
>
> For Alt2, you'll need to define a fixed resolution for the fractions. If
> that cannot be done, use Alt1.
>
> - ak
>
> P.S. As a newcomer, I would rather recommend using Lua 4.0, instead of the
> 5.0 beta. If you don't need any of the new fancy features (e.g. better
> multithreading support), 4.0 will do nicely for you. There is no 'forced
> upgrade policy' within the Lua community! ;)