lua-users home
lua-l archive

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



On Feb 18, 2014, at 11:53 PM, Joachim Bürmann <jbuermann@iftools.com> wrote:

Sorry to repeat again, but I'm unsure if my former mail address is still in use ( lua@bazar2.conectiva.com.br )

Helle there,

We are using Lua for protocol templates in our serial field-bus analyzers (for interest, see here https://iftools.com/analyzer/news/topic/index.en.php )

I'm trying to compare the binary chunk of two functions for equality.

Unfortunatelly it seems that different white spaces or different comments lead to a different chunk (or byte code).
My hope was that comparing only the chunk gets me rid of removing all comments and spare white spaces by hand.

I also checked the result of the luac program with two identical function and only different comments. Here also the produced binaries are unequal.

I'm not very familiar with the Lua byte code. I just assumed that the byte code of a block only differs when the functional code is different but not when only the comments or white spaces  in the block are unequal.
Maybe I was wrong here - or (better) I have missed something.

I would really appreciate it someone is able to put some light on this matter.

Thanks a lot and best regards

Joachim Bürmann


I would expect this as the chunk contains information for debugging, including source code locations. I don’t think relying on chunk identity is a good approach to solving your problem. Can you explain what the underlying problem is in a little more detail?

—Tim