Модуль:Prototypes/Хранилище/Предмет: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 210: | Строка 210: | ||
-- Обработка NestedSelector | -- Обработка NestedSelector | ||
handleNestedSelector = function(nestedSelector) | handleNestedSelector = function(nestedSelector, wrapped) | ||
local result = '' | local result = '' | ||
local tableId = nestedSelector.tableId | local tableId = nestedSelector.tableId | ||
| Строка 216: | Строка 216: | ||
-- Генерация классов для div | -- Генерация классов для div | ||
local classes = {} | if wrapped then | ||
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 | |||
-- Обёртка div с классами | |||
local classString = table.concat(classes, ' ') | |||
result = result .. string.format('<div class="%s">', classString) | |||
result = result .. getTableOutput(tableId) | |||
result = result .. '</div>' | |||
else | |||
-- Без обёртки | |||
result = result .. getTableOutput(tableId) | |||
end | end | ||
return result | return result | ||