From f4c6ce100409b8374e6603e840731f7f0c4dfe44 Mon Sep 17 00:00:00 2001 From: bakpakin Date: Sun, 22 Mar 2015 08:15:44 +0800 Subject: [PATCH] Remove use of table.pack --- jojo.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/jojo.lua b/jojo.lua index 2156d3f..059533a 100644 --- a/jojo.lua +++ b/jojo.lua @@ -29,7 +29,6 @@ jojo.World = World jojo.Aspect = Aspect jojo.System = System -local tpack = table.pack local tinsert = table.insert local tremove = table.remove local tconcat = table.concat @@ -98,10 +97,8 @@ end -- Composes multiple Aspects into one Aspect. The resulting Aspect will match -- any Entity that matches all sub Aspects. function Aspect.compose(...) - local args = tpack(...) local newa = {{}, {}, {}} - for j = 1, args.n do - local a = args[j] + for _, a in ipairs{...} do if a[4] then return Aspect() end @@ -175,7 +172,7 @@ end -- Systems after creation. function World:init(...) - local args = tpack(...) + local args = {...} -- Table of Entity IDs to status self.status = {} @@ -205,7 +202,7 @@ end -- Adds Entities to the World. An Entity is just a table of Components. function World:add(...) - local args = tpack(...) + local args = {...} local status = self.status local entities = self.entities for _, e in ipairs(args) do @@ -222,7 +219,7 @@ end -- Call this function on any Entities that have changed such that they would -- now match different systems. function World:changed(...) - local args = tpack(...) + local args = {...} local status = self.status for _, e in ipairs(args) do status[e._id] = "add" @@ -233,7 +230,7 @@ end -- Frees Entities from the World. function World:free(...) - local args = tpack(...) + local args = {...} local status = self.status for _, e in ipairs(args) do status[e._id] = "free"