Lua Five Three |
|
在此處可找到 5.2 和 5.3 之間的差異摘要
公告
Wiki 上也描述了受影響的部分,包括
string.dump
https://lua.dev.org.tw/work/doc/manual.html#pdf-string.dump strip
可用於 LuaCompilerInLua,先前則可在 LuaJit 找到。本頁可能討論的其他部分:LuaJIT?和 LuaImplementations?IDE 支援?
table.move (a1, f, e, t [,a2])
https://lua.dev.org.tw/work/doc/manual.html#pdf-table.move
此新函式複製一系列值。
就設計而言,此函式類似 C memmove
[1] 函式,但並非以其為基礎實作。來源和目標範圍可能重疊(與 C memcpy
不同)。
table.move
也提供一種清除(全部或一部份)陣列的便利方式
table.move(a, #a+1, 2*#a, 1)
table.move
在 5.3.0(alpha) 中以前稱為 table.copy
。
table.move
內部是以 lua_geti
/lua_seti
[2][3] 或(如果 t
缺乏 __index
/__newindex
元方法)lua_rawgeti
/lua_rawseti
[4]/[5] 實作。(參閱 ltablib.c
中的 checktab
/aux_getn
和 tmove
。)
void lua_rotate (lua_State *L, int idx, int n);
https://lua.dev.org.tw/manual/5.3/manual.html#lua_rotate
討論
觀察 lua_insert
和 lua_remove
在 lua.h 中對 lua_rotate
的定義
#define lua_insert(L,idx) lua_rotate(L, (idx), 1) #define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1))
自述檔上說:「arg 表單可用於所有程式碼」。
討論
討論