lua-users home
lua-l archive

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

Your situation is very similar to mine, and perhaps to most people
porting Lua to an embedded system. In my case the platform I ported to
did not have support for most of the C standard library, including
strings, files and memory allocation.

Memory allocation is simple, just pass a realloc function and object to

For the others, I replaced all the uses of the C file and string
functions with appropriate macro calls instead. Then I defined those
macros to map to my non standard functions. To reduce the chance of
errors, I made the macro functions have an identical interface to the C
standard functions. In some cases this required me to write small
adapter functions for my string libraries, but this is generally

I also simplified things by removing all the Lua standard libs that my
project doesn't require (IO, OS and String libs). Note that even when
these libs are left out, there are a lot of file and string uses in the
lua code that require changing.

Hope that helps.

- DC