lua-users home
lua-l archive

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


correct, i=5.2998088236266e-315

I found this by doing something like:

i=1
stateTable = { .... }

and then having it bomb when trying to access stateTable[i]

If I do a i=tonumber("1"), I actually get i=1

The strange thing is this only appears (AFAIK) to be in literal assignments.  For instance, if I use a literal number in a function, or in a table such as:

status = {
  ok = 1,
  error = 2,
  ...
}

it also initializes fine.

I need to check next week to see how it was compiled into the system (don't have it with me here).

Mike

On Sun, Aug 10, 2008 at 9:15 AM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
In message <16d4c3590808100603u7de5bffkeecaef84d2805398@mail.gmail.com">16d4c3590808100603u7de5bffkeecaef84d2805398@mail.gmail.com>
you wrote:


> I'm using lua on an embedded ARM device, and everything worked great until I
> added a 3rd party library which didn't work. ....
> The problem seems to be with using literal numbers.  If I do:
>
> i = 1
>
> and then log what I is, I get:

Did you mean i?

> = 5.2998088236266e-315

ARMs do not do floating point as a rule, especially not in embedded
devices. What, if anything, is supplying your fp processing,
and what type of LUA_NUM is your lua compiled with?

--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/