diff options
Diffstat (limited to 'src/lib_table.c')
-rw-r--r-- | src/lib_table.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib_table.c b/src/lib_table.c index f9a3693d..0204f25d 100644 --- a/src/lib_table.c +++ b/src/lib_table.c | |||
@@ -129,6 +129,26 @@ LJLIB_LUA(table_remove) /* | |||
129 | end | 129 | end |
130 | */ | 130 | */ |
131 | 131 | ||
132 | LJLIB_LUA(table_move) /* | ||
133 | function(a1, f, e, t, a2) | ||
134 | CHECK_tab(a1) | ||
135 | CHECK_int(f) | ||
136 | CHECK_int(e) | ||
137 | CHECK_int(t) | ||
138 | if a2 == nil then a2 = a1 end | ||
139 | CHECK_tab(a2) | ||
140 | if e >= f then | ||
141 | local d = t - f | ||
142 | if t > e or t <= f or a2 ~= a1 then | ||
143 | for i=f,e do a2[i+d] = a1[i] end | ||
144 | else | ||
145 | for i=e,f,-1 do a2[i+d] = a1[i] end | ||
146 | end | ||
147 | end | ||
148 | return a2 | ||
149 | end | ||
150 | */ | ||
151 | |||
132 | LJLIB_CF(table_concat) LJLIB_REC(.) | 152 | LJLIB_CF(table_concat) LJLIB_REC(.) |
133 | { | 153 | { |
134 | GCtab *t = lj_lib_checktab(L, 1); | 154 | GCtab *t = lj_lib_checktab(L, 1); |