diff options
-rw-r--r-- | server/src/vm/vm.lua | 28 | ||||
-rw-r--r-- | server/test/full/normal.lua | 6 |
2 files changed, 21 insertions, 13 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index b37ff153..0aae9f51 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -44,20 +44,22 @@ function mt:buildTable(source) local emmy = self:getEmmy() if obj.type == 'pair' then local value = self:getFirstInMulti(self:getExp(obj[2])) - local key = obj[1] - self:instantSource(obj) - self:instantSource(key) - key:bindValue(value, 'set') - value:setEmmy(emmy) - if key.type == 'index' then - local index = self:getIndex(key) - key:set('parent', tbl) - tbl:setChild(index, value, key) - else - if key.type == 'name' then + if value then + local key = obj[1] + self:instantSource(obj) + self:instantSource(key) + key:bindValue(value, 'set') + value:setEmmy(emmy) + if key.type == 'index' then + local index = self:getIndex(key) key:set('parent', tbl) - key:set('table index', true) - tbl:setChild(key[1], value, key) + tbl:setChild(index, value, key) + else + if key.type == 'name' then + key:set('parent', tbl) + key:set('table index', true) + tbl:setChild(key[1], value, key) + end end end elseif obj.type:sub(1, 4) == 'emmy' then diff --git a/server/test/full/normal.lua b/server/test/full/normal.lua index c6897067..c51a34c6 100644 --- a/server/test/full/normal.lua +++ b/server/test/full/normal.lua @@ -130,3 +130,9 @@ end TEST [[ t[...] = 1 ]] + +TEST [[ +return { + [...] = ... +} +]] |