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

local function asFunction(source)
    if not source.args then
        return ''
    end
    local args = {}
    for i = 1, #source.args do
        local arg = source.args[i]
        args[i] = ('%s: %s'):format(guide.getName(arg), vm.getType(arg))
    end
    return table.concat(args, ', ')
end

return function (source)
    if source.type == 'function' then
        return asFunction(source)
    end
end