lua-users home
lua-l archive

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


I was thinking about checksums earlier for another reason (to hash a lot of table values into one key value). You're right that could occur here.

Are there any examples of this being done that I could look at?

Thanks.

On Fri, Jan 4, 2013 at 3:38 PM, Marc Balmer <marc@msys.ch> wrote:

> Apologies if this seems half-baked.
>
> I am wondering if it is possible, or even a common pattern, to be able to specify a set of objects (say tables) at time A, and later at time B to be able to know if that set of objects has had any changes.
>
> By any changes, I mean:
>   - removed fields
>   - added fields
>   - changed field values
>   - changed metatables and values in metatables
>
> Assume the ability to add C code to do this (i.e. it doesn't have to be done in pure Lua).
>
> Basically, I am asking if I can know if there have been changes to a set of Lua objects, from C, without having to proxy out everything in Lua to detect it there.

you could iterate over the table and calculate a checksum.  reiterate later to see if it changed.