summaryrefslogtreecommitdiff
path: root/server/src/core/value.lua
blob: 2285738baa67be8475fa4cec7ac7735d26a414b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local DefaultSource = { start = 0, finish = 0 }

local mt = {}
mt.__index = mt
mt.type = 'value'

return function (tp, uri, source, value)
    if tp == '...' then
        error('Value type cant be ...')
    end
    -- TODO lib里的多类型
    if type(tp) == 'table' then
        tp = tp[1]
    end
    local self = setmetatable({
        type = tp,
        source = source or DefaultSource,
        value = value,
        uri = uri,
    }, mt)
    return self
end