Lua Five Three

lua-users home

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 .

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


Areas affected also described on the wiki include

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


table.move (a1, f, e, t [,a2])

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


void lua_rotate (lua_State *L, int idx, int n);


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


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


"userdata can have any Lua value as uservalue"


RecentChanges · preferences
edit · history
Last edited January 2, 2015 1:11 am GMT (diff)