[added] table.reverse, vec3 to init.lua

This commit is contained in:
Max Cahill 2020-02-05 21:16:23 +11:00
parent 0a1e55b300
commit 9d556574f1
2 changed files with 11 additions and 0 deletions

View File

@ -25,6 +25,7 @@ sequence = require(relative_file("sequence"))
unique_mapping = require(relative_file("unique_mapping")) unique_mapping = require(relative_file("unique_mapping"))
vec2 = require(relative_file("vec2")) vec2 = require(relative_file("vec2"))
vec3 = require(relative_file("vec3"))
intersect = require(relative_file("intersect")) intersect = require(relative_file("intersect"))
state_machine = require(relative_file("state_machine")) state_machine = require(relative_file("state_machine"))

View File

@ -83,6 +83,16 @@ function table.shuffle(t, r)
local j = _random(1, #t, r) local j = _random(1, #t, r)
t[i], t[j] = t[j], t[i] t[i], t[j] = t[j], t[i]
end 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 end
--(might already exist depending on luajit) --(might already exist depending on luajit)