Sorry I don't know what's going on. It seems to be garbage stored at IUP side when the Lua context is destroyed but the IUP internal context is not. But I checked what's stored from Lua and it seems to be refresh when iuplua is initialized again.
So, if iup.Close is called, the scripts work ok? The problem does not occurs, right?
The maybe you could force a iup.Close on a Lua error. Because Lua errors are trapped by iuplua, if the application does not overwrite that behavior.
Best,
Scuri