lua-users home
lua-l archive

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


> I'm designing a binary file format, and I'd like to be able to 
> embed byte-compiled 
> Lua chunks in it. I looked in the refman, but I wasn't able to 
> find anything on it. 
> So, can I store byte-compiled chunks in null-terminated C 
> strings? Specifically, 
> will there be any stray nulls in a byte-compiled chunk?

No. you can't rely on that. imagine this script:
s = "\0" -- this string as a constant, will be part of the chunk!

Cheers,
Peter

P.S.
Lua strings can contain binary data with 0's in them.