Lua Five Three

lua-users home
wiki

Lua 5.3 will soon be the latest major revision of Lua following 5.2. This page has some notes on 5.3. Official information and downloads on Lua 5.3 can be found at http://www.lua.org/manual/5.3 .

Summaries of differences between 5.2 and 5.3 can be found here:

Announcements:

Areas affected also described on the wiki include

Other areas this page might address: LuaJIT? and LuaImplementations? IDE support?

table.move

table.move (a1, f, e, t [,a2]) http://www.lua.org/work/doc/manual.html#pdf-table.move

This new function does a copy of a range of values.

Design-wise, this function bears some resemblance to the C memmove [1] function but is not implemented in terms of it. The source and destination ranges may overlap (unlike the C memcpy).

table.move provides a convenient way to clear (all or some of) an array too:

table.move(a, #a+1, 2*#a, 1)

table.move was previously named table.copy in 5.3.0(alpha).

table.move is internally implemented with lua_geti/lua_seti [2][3] or (if t lacks __index/__newindex metamethods) lua_rawgeti/lua_rawseti [4]/[5]. (See checktab/aux_getn and tmove in ltablib.c.)

lua_rotate

void lua_rotate (lua_State *L, int idx, int n); https://www.lua.org/manual/5.3/manual.html#lua_rotate

Discussions:

Observe lua.h definitions of lua_insert and lua_remove in terms of 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

The readme says "arg table available to all code".

Discussions:

"userdata can have any Lua value as uservalue"

Discussions:


RecentChanges · preferences
edit · history
Last edited March 1, 2018 9:09 am GMT (diff)