mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
[added] tablex.flatten as an alias for collapse
This commit is contained in:
parent
d22cf7a66c
commit
18d02434a0
@ -122,7 +122,7 @@ if love and love.math and love.math.random then
|
||||
_global_random = love.math.random
|
||||
end
|
||||
local function _random(min, max, r)
|
||||
return r and r:random(min, max)
|
||||
return r and r:random(min, max)
|
||||
or _global_random(min, max)
|
||||
end
|
||||
|
||||
@ -221,7 +221,7 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
--note:
|
||||
--note:
|
||||
-- copies and overlays are currently not satisfactory
|
||||
--
|
||||
-- i feel that copy especially tries to do too much and
|
||||
@ -301,6 +301,9 @@ function tablex.collapse(t)
|
||||
return r
|
||||
end
|
||||
|
||||
--alias
|
||||
tablex.flatten = tablex.collapse
|
||||
|
||||
--faster unpacking for known-length tables up to 8
|
||||
--gets around nyi in luajit
|
||||
--note: you can use a larger unpack than you need as the rest
|
||||
@ -334,4 +337,4 @@ function tablex.unpack8(t)
|
||||
return t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8]
|
||||
end
|
||||
|
||||
return tablex
|
||||
return tablex
|
||||
|
Loading…
Reference in New Issue
Block a user