lua-users home
lua-l archive

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


We were in a similar situation last year, we ended up defining the
lua_Number as int and added a new basic type, 'lua_Float' (in our case
it was implemented as an actual float, but it could have been some
kind of fixed point type). It was surprisingly easy to implement, and
the lua code was mostly unchanged (just keep in mind that "5" and
"5.0" are 2 different types now).
We didn't use the existing lua numbers patch because we wanted to
avoid all the automatic conversions.

On 10/16/07, Daniel Collins <dcplus@bigpond.com> wrote:
> Last year when I was using Lua on an ARM mobile phone (no FPU) I had
> much the same decision to make. In the end I ended up defining
> LUA_NUMBER as int and making a user data module for fixed point
> operations precisely because I was afraid of how much work would be
> involved in making LUA_NUMBER a fixed point type.
>
> If you are compiling as C++ then perhaps operator overloading would
> allow much of the lua code to work as is, but you would need to
> implement fixed point versions of many of the maths library functions.
>
>