[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Potential playground for embeddedLua?
- From: Zachary Landau <kapheine@...>
- Date: Wed, 3 Aug 2005 14:21:26 -0400
> one thing that i'm concerned about is that arm processors don't have any
> sort of floating point unit, so floating point operations are emulated
> in software which is obviously very slow. i've seen it mentioned a few
> times that changing lua to represent numbers with a different type is
> trivial but i haven't heard any caveats which come with doing so. i'm
> especially worried about running the same code with a modified lua
> interpreter and a non-modified one and having the output be slightly
> different. does anyone have any experiences to share?
Jolan,
I've modified Lua socket to use integers for running on a ColdFire.
To do this, I defined USE_INT and included luser_number.h, as
mentioned in 'config' in the root directory. This worked well, but
there are a few things to watch out for:
* Make sure any libraries you compile into Lua also know that you
are using ints instead of doubles. Otherwise you will get some fun
errors when the two libraries try to communicate
* You may want to modify some libraries to work better with
integers. For example, luasocket allows sub-second timeouts by using
floating point numbers. This won't work anymore, so you'll have to do
something like taking in msecs instead of seconds.
Also, when running Lua on embedded platforms, you may want to lower
MAXVARS and MAXUPVALUES. Otherwise it is fairly easy to get a stack
overflow.
--
Zachary P. Landau <kapheine@gmail.com>