Memory Limits |
|
struct myalloc_ud { int max; int cur; }
Then construct an allocator that just adds the new size and subtracts the old size from cur for every allocation (this will work because old size will be zero for a new allocation and new size will be zero for a deallocation) and return NULL if cur would exceed max. Pass this allocator and your userdata to lua_newstate.
-- SeanLynch