lua-users home
lua-l archive

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


Just wondering if anyone has ever implemented a VM "stepping" mechanism.

My goals are to create a sandbox that can run 1000's if not perhaps 100,000's of user contributed lua scripts simultaneously, and I would control them by manually stepping the VM interpreter.

So a user could easily write an infiinite loop, it wouldn't matter - I don't have to be "bound up" in the lua thread waiting for you to return, I can just tick.

looking through luaV_execute makes me think that it would be possible, although that newframe label might fowl up the logic a bit, but I can see a few ways of bypassing that.

void luaV_execute (lua_State *L) {
  CallInfo *ci = L->ci;
  LClosure *cl;
  TValue *k;
  StkId base;
 newframe:  /* reentry point when frame changes (call/return) */
  lua_assert(ci == L->ci);


But the project looks reasonably straightforward to implement, has anyone tried, is there existing code?


--
-Prozacgod

"Prozac may heal the mind, but friends can mend the soul"