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

local m = {}

function m:field(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.field, 'set')
            elseif src.type == 'tableindex' then
                callback(src.index, 'set')
            end
        end
    end
end

return m