lua-users home
lua-l archive

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


Hi,

  I am pretty new to Lua. I am trying to use it as a policy language
in ARM TrustZone. I want to compile it into my application directly
from source. I am using OPTEE-OS which has a minimal libc. I took a
look at the Makefile in the src/. It seems that there is CORE_O and
LIB_O for building liblua.

  My use case is that a part of a file will be Lua script. My C
application will parse this file and feed the chunks in a buffer to
Lua interpreter through the C API.

   I have the following questions:

   1) Is libLua the C API I develop against (can it do everything that
is in the Programming in Lua PART IV)? If not....the only object files
it doesn't include is lua.c and luac.c...so...
   2) I just require the interpreter and some of the standard
libraries. I do not need coroutine, package, io, module, os, utf8 or
debug std library. To remove these, which object files in LIB_O should
I leave out? I can see lcorolib.o, loadlib.o, oslib.o, but the rest is
hard to do a one-to-one match. Would this break Lua build in any way?
    3a) I see luaL_loadbufferx() as the C API to give a buffer to Lua
interpreter. I am wondering what the semantic is. Does the buffer you
give have to be a complete Lua script? Or can you repeatedly feed it
line-by-line, character-by-character?
    3b) Does it run the script automatically or is there a function I
have to call to evaluate the script in the buffer?
    3c) If it runs automatically, what if my script has functions
also, how do I call a specific Lua function to run in the script?
    3d) Once I run luaL_loadbufferx(), how do I get the return value
of the Lua script?

    I really only need a minimal version of the Lua. Just the
interpreter, C API, auxiilary library  base, string, table, and math
standard libraries. The reason I want to remove unnecessary parts is
that I am not sure what OPTEE is missing in its libc (so far I think I
might be missing setjmp/longjmp).

Thanks.

Peter