fix: enforcing template option required

This commit is contained in:
danymat
2022-01-12 10:07:47 +01:00
parent 402cc7b52e
commit 02d7ab21b4

View File

@@ -135,7 +135,7 @@ neogen.default_generator = function(parent, data, template, required_type)
-- If one item is missing, it'll use the required option to iterate
-- and will replace the missing item with default jump_text
if data[opts.required] or data[inserted_type[1]] then
if data[opts.required] or (data[inserted_type[1]] and opts.required == nil) then
local count = opts.required and #data[opts.required] or #data[inserted_type[1]]
for i = 1, count do
local _values = {}