diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-13 16:40:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-13 16:40:28 -0300 |
commit | 5a5a834975d135054e803b90711fcb9deb6511b8 (patch) | |
tree | 9b028d3e480b677192a6da06271f38599cb33569 /lua.h | |
parent | 45c430eac04b070a996437b79e40656942a4c7d4 (diff) | |
download | lua-5a5a834975d135054e803b90711fcb9deb6511b8.tar.gz lua-5a5a834975d135054e803b90711fcb9deb6511b8.tar.bz2 lua-5a5a834975d135054e803b90711fcb9deb6511b8.zip |
new API function 'lua_rotate'
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.304 2014/05/01 18:21:32 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.305 2014/05/08 13:52:20 roberto Exp roberto $ |
3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
@@ -145,8 +145,7 @@ LUA_API int (lua_absindex) (lua_State *L, int idx); | |||
145 | LUA_API int (lua_gettop) (lua_State *L); | 145 | LUA_API int (lua_gettop) (lua_State *L); |
146 | LUA_API void (lua_settop) (lua_State *L, int idx); | 146 | LUA_API void (lua_settop) (lua_State *L, int idx); |
147 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); | 147 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); |
148 | LUA_API void (lua_remove) (lua_State *L, int idx); | 148 | LUA_API void (lua_rotate) (lua_State *L, int idx, int n); |
149 | LUA_API void (lua_insert) (lua_State *L, int idx); | ||
150 | LUA_API void (lua_replace) (lua_State *L, int idx); | 149 | LUA_API void (lua_replace) (lua_State *L, int idx); |
151 | LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); | 150 | LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); |
152 | LUA_API int (lua_checkstack) (lua_State *L, int sz); | 151 | LUA_API int (lua_checkstack) (lua_State *L, int sz); |
@@ -326,9 +325,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
326 | ** =============================================================== | 325 | ** =============================================================== |
327 | */ | 326 | */ |
328 | 327 | ||
329 | #define lua_tonumber(L,i) lua_tonumberx(L,i,NULL) | 328 | #define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) |
330 | #define lua_tointeger(L,i) lua_tointegerx(L,i,NULL) | 329 | #define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) |
331 | #define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL) | 330 | #define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) |
332 | 331 | ||
333 | #define lua_pop(L,n) lua_settop(L, -(n)-1) | 332 | #define lua_pop(L,n) lua_settop(L, -(n)-1) |
334 | 333 | ||
@@ -356,6 +355,10 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
356 | #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) | 355 | #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) |
357 | 356 | ||
358 | 357 | ||
358 | #define lua_insert(L,idx) lua_rotate(L, (idx), 1) | ||
359 | |||
360 | #define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) | ||
361 | |||
359 | 362 | ||
360 | /* | 363 | /* |
361 | ** {====================================================================== | 364 | ** {====================================================================== |