lua-users home
lua-l archive

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


On Tue, Nov 3, 2009 at 7:27 PM, Matthew P. Del Buono
<delbu9c1@my.erau.edu> wrote:
> Neither of these, however, are Lua-only solutions.

People often seem to point at standard library functions being
problematic. I don't see anything special about standard library
functions - if you have a problem with them, then you've got their
source code, so you can provide your own custom standard library which
calls hooks from within the inner loops of standard functions.

Could you not just hook every N virtual machine instructions (via
sethook), every call (again via sethook), every memory allocation (by
changing the allocator function at runtime), and provide custom
versions of all standard library functions which call a hook on every
N iterations of their inner loop(s)? Most of these hooks would just
check elapsed time, and the memory allocator would also check against
a memory limit. Unless I'm missing something, surely this would be a
Lua-only solution?