summaryrefslogtreecommitdiff
path: root/server-beta/src/seacher/table.lua
blob: 851ee791b10ef1313bc906ca1fac79269c576477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local guide    = require 'parser.guide'

local m = {}

function m:eachField(source, key, callback)
    for i = 1, #source do
        local src = source[i]
        if key == guide.getKeyName(src) then
            if     src.type == 'tablefield' then
                callback(src, 'set')
            elseif src.type == 'tableindex' then
                callback(src, 'set')
            end
        end
    end
end

function m:eachValue(source, callback)
    callback(source)
end

return m