mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 14:14:36 +00:00
[added] table.reverse, vec3 to init.lua
This commit is contained in:
parent
0a1e55b300
commit
9d556574f1
1
init.lua
1
init.lua
@ -25,6 +25,7 @@ sequence = require(relative_file("sequence"))
|
||||
unique_mapping = require(relative_file("unique_mapping"))
|
||||
|
||||
vec2 = require(relative_file("vec2"))
|
||||
vec3 = require(relative_file("vec3"))
|
||||
intersect = require(relative_file("intersect"))
|
||||
|
||||
state_machine = require(relative_file("state_machine"))
|
||||
|
10
table.lua
10
table.lua
@ -83,6 +83,16 @@ function table.shuffle(t, r)
|
||||
local j = _random(1, #t, r)
|
||||
t[i], t[j] = t[j], t[i]
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
--reverse the order of a table
|
||||
function table.reverse(t)
|
||||
for i = 1, #t / 2 do
|
||||
local j = #t - i + 1
|
||||
t[i], t[j] = t[j], t[i]
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
--(might already exist depending on luajit)
|
||||
|
Loading…
Reference in New Issue
Block a user