lua-users home
lua-l archive

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


these function as API may reduce dll calls, and reduce lua lock operatiosn. and to do loop in lua core may faster than do that youself.


2014-03-01 19:08 GMT+08:00 Dirk Laurie <dirk.laurie@gmail.com>:
2014-03-01 11:25 GMT+02:00 Xavier Wang <weasley.wx@gmail.com>:

> 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.

I agree that those functions would be useful.

I don't agree that they need to be added to the API. They are really easy to
write for yourself, and will not be needed often enough to justify being
described in the User's Manual.




--
regards,
Xavier Wang.