lua-users home
lua-l archive

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


Hi,

Is there a simple and esthetic way to embed Lua source code into a C
source file ? My problem is that I'd like to bundle in a .so that
cannot open another file (with luaL_openfile) for example.

My first thought is to put the Lua chunk into a big ugly #define line,
such as :

  #define LUA_CODE "print('hello, world')"

And then use loadbuffer and run the compiled chunk, but it's a bit
hard to escape the Lua chunk code from a separate file so it can be
safely included in the #define line.

Any hints or previous experience ?

Bests,
- Maxime

-- 
Maxime Petazzoni (http://www.bulix.org)
 -- gone crazy, back soon. leave message.

Attachment: signature.asc
Description: Digital signature