lua-users home
lua-l archive

Re: What is the preferred way to embed multi-line string in C source?

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


> Good thought. Maybe an array of such strings, each limited to 4K?
I guess this was David's suggestion. But you do not need to worry about
the 4K limit, unless you have really long lines:
char *prog[] = {
 "function foo ()",
 " return x",
 "end"
};
As I said, with a proper lua_Reader, you can feed each line one by one
to lua_load, without concatenating them. (If you want, the lua_Reader
may also inser the newlines between lines.)
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /