mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-15 12:19:47 +07:00
impl compat.move for 5.1 vanilla lua
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
- [ ] add batch vector operations
|
||||
- [ ] add inplace vector operations
|
||||
- [x] cache chunk lists in batch operations
|
||||
- [ ] impl compat.move for 5.1 vanilla lua
|
||||
- [x] impl compat.move for 5.1 vanilla lua
|
||||
- [x] add registry.batch_set
|
||||
- [x] rename include/exclude/execute to query_include/exclude/execute
|
||||
- [x] rename entities/components to chunk_entities/components
|
||||
|
||||
@@ -10,7 +10,23 @@ compat.unpack = table.unpack or function(list, i, j)
|
||||
end
|
||||
|
||||
compat.move = table.move or function(a1, f, e, t, a2)
|
||||
error('compat.move is not implemented yet', 2)
|
||||
if a2 == nil then
|
||||
a2 = a1
|
||||
end
|
||||
|
||||
if e < f then
|
||||
return a2
|
||||
end
|
||||
|
||||
local d = t - f
|
||||
|
||||
if t > e or t <= f or a2 ~= a1 then
|
||||
for i = f, e do a2[i + d] = a1[i] end
|
||||
else
|
||||
for i = e, f, -1 do a2[i + d] = a1[i] end
|
||||
end
|
||||
|
||||
return a2
|
||||
end
|
||||
|
||||
return compat
|
||||
|
||||
Reference in New Issue
Block a user