library Metatable
globals
private hashtable metatable = InitHashtable()
endglobals
//! textmacro META_SET takes FUNCNAME, NATIVE, TYPE, ENTRYCHECK
function $FUNCNAME$ takes hashtable hash, integer parentKey, integer childKey, $TYPE$ value returns nothing
if (not $ENTRYCHECK$(hash, parentKey, childKey)) then
call SaveInteger(metatable, GetHandleId(hash), parentKey, LoadInteger(metatable, GetHandleId(hash), parentKey) + 1)
endif
endfunction
//! endtextmacro
// Repeat this for the number of hashtable setter natives
//! runtextmacro META_SET("SaveIntegerEx", "SaveInteger", "integer", "HaveSavedInteger")
...
function FlushChildHashtableEx takes hashtable hash, integer parentKey returns nothing
call RemoveSavedInteger(metatable, hash, parentKey)
call FlushChildHashtable(hash, parentKey)
endfunction
endlibrary