lua-users home
lua-l archive

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



The only difference between the tow functions is an additional line feed
after the comment. But it's enough to make the chunk unequal.

This is due to the debug information contained in the binary chunk.
Unfortunately, there is no public API for removing debug information.
If you can patch your version of Lua, just edit lapi.c and change

LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
...
    status = luaU_dump(L, getproto(o), writer, data, 0);

to

LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) {
...
    status = luaU_dump(L, getproto(o), writer, data, strip);

and call lua_dump with strip=1.

Although I hope the above change will someday make it into an official Lua release, I believe it won't solve the problem at hand.

Even with debug info stripped, the compiled chunk will still contain line number information (which, in practice, I find very helpful btw.).

Ashwin.