[fixed] missing exports for some aliases, simplified export

This commit is contained in:
Max Cahill 2020-08-09 19:49:24 +10:00
parent b4e2cff498
commit 616b31b35f

View File

@ -51,11 +51,12 @@ end
--easy export globally if required --easy export globally if required
function _batteries:export() function _batteries:export()
--export oo --export all key strings globally, if doesn't always exist
class = self.class for k, v in pairs(self) do
if not _G[k] then
--export assert _G[k] = v
assert = self.assert end
end
--overlay tablex and functional and sort routines onto table --overlay tablex and functional and sort routines onto table
self.tablex.overlay(table, self.tablex) self.tablex.overlay(table, self.tablex)
@ -63,37 +64,12 @@ function _batteries:export()
table.overlay(table, self.functional) table.overlay(table, self.functional)
self.sort:export() self.sort:export()
--functional module also available separate from table
functional = self.functional
--export collections
sequence = self.sequence
set = self.set
--overlay onto global math table --overlay onto global math table
table.overlay(math, self.mathx) table.overlay(math, self.mathx)
--overlay onto string --overlay onto string
table.overlay(string, self.stringx) table.overlay(string, self.stringx)
--export geom
vec2 = self.vec2
vec3 = self.vec3
intersect = self.intersect
--"misc" :)
unique_mapping = self.unique_mapping
state_machine = self.state_machine
async = self.async
manual_gc = self.manual_gc
--support both spellings
colour = self.colour
color = self.colour
--export top level module as well for ease of migration for code
batteries = self
return self return self
end end