lua-users home
lua-l archive

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


I found we can only maintain a single value on Lua stack, the only routine can maintain multi-values of lua stack is lua_settop(lua_pop). we can not:
  - copy a range of stack to stack top (mult-version of lua_pushvalue)
  - remove a range of stack (multi-version of lua_remove)
  - insert multi value to middle of stack (multi-version of lua_insert)
  - replace multi value to middle of stack (multi-version of lua_replace)
  - copy multi values from a place to another (multi-version of lua_copy)
  - copy multi values from a thread to another (copy-version of lua_xmove)

we needn't all these functions. only a few function is really needed, like:
  - void lua_pushvalues(lua_State *L, int first, int last);
  - void lua_removevalues(lua_State *L, int first, int last);
  - void lua_xcopy(lua_State *from, lua_State *to, int n);

a multi-version of lua_remove is very most important -- to implement a proper vaeriosn of lua_removevalues need careful, a loop of lua_remove will cause O(n^2) behavior :-(

if we have lua_pushvalues, then lua_xcopy is not so important, now we can not push a range of lua value on stack, that need a loop, which is not convenience.

maybe Roberto can review this and add at least lua_pushvalues and lua_removevalues to Lua 5.3

thank you!


--
regards,
Xavier Wang.