summaryrefslogtreecommitdiff
path: root/server/src/vm/source.lua
blob: 1e9001d1109a67e6fbcc4f6ef8223dd8124523da (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
local mt = {}
mt.__index = mt
mt._hasInstant = true

function mt:bindLocal(loc)
    if loc then
        self._bindLocal = loc
    else
        return self._bindLocal
    end
end

function mt:bindLabel(label)
    if label then
        self._bindLabel = label
    else
        return self._bindLabel
    end
end

function mt:bindFunction(func)
    if func then
        self._bindFunction = func
    else
        return self._bindFunction
    end
end

function mt:bindValue(value, action)
    if value then
        self._bindValue = value
        value:addInfo(action, self)
    else
        return self._bindValue
    end
end

function mt:setUri(uri)
    self._uri = uri
end

function mt:getUri()
    return self._uri
end

return function (source)
    if source._hasInstant then
        return false
    end
    setmetatable(source, mt)
    return true
end