blob: 119a9349bdd7a5ddc2f6e19be2c11fab04830ba9 (
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
|
return function (source)
local value = source:bindValue()
local func = value:getFunction()
local declarat
if func then
declarat = func.source.name
else
declarat = source
end
if not declarat then
return source:getName() or ''
end
local key
if declarat.type == 'name' then
key = declarat[1]
elseif declarat.type == 'string' then
key = ('%q'):format(declarat[1])
elseif declarat.type == 'number' or declarat.type == 'boolean' then
key = tostring(declarat[1])
else
key = ''
end
return key
end
|