Модуль:Prototypes/Хранилище/Предмет: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 192: | Строка 192: | ||
-- Обработка NestedSelector | -- Обработка NestedSelector | ||
handleNestedSelector = function(nestedSelector) | |||
local result = '' | local result = '' | ||
local | local tableId = nestedSelector.tableId | ||
if not tableId then return result end | |||
-- Генерация классов для div | |||
local classes = {} | |||
if nestedSelector.rolls and nestedSelector.rolls.range then | |||
table.insert(classes, 'rolls-' .. tostring(nestedSelector.rolls.range):gsub(',', '-')) | |||
end | |||
if nestedSelector.prob then | |||
table.insert(classes, 'prob-' .. tostring(math.floor(nestedSelector.prob * 100)) .. 'p') | |||
end | end | ||
-- | -- Обёртка div с классами | ||
local classString = table.concat(classes, ' ') | |||
result = result .. string.format('<div class="%s">', classString) | |||
result = result .. getTableOutput(tableId) | |||
result = result .. '</div>' | |||
return result | return result | ||