summaryrefslogtreecommitdiff
path: root/script/emmy/arrayType.lua
blob: c5d73500bf31fd0094135395194d3cc139b38f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local listMgr = require 'vm.list'

---@class EmmyArrayType
local mt = {}
mt.__index = mt
mt.type = 'emmy.arrayType'

function mt:getType()
    return 'table'
end

function mt:getName()
    return self.name
end

function mt:getSource()
    return listMgr.get(self.source)
end

function mt:setValue(value)
    self.value = value
    self._child:setValue(value)
end

function mt:getValue()
    return self.value
end

return function (manager, source, child)
    local self = setmetatable({
        name = child:getName(),
        source = source.id,
        _child = child,
        _manager = manager,
    }, mt)
    return self
end