comparison mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua @ 4049:78f1de5301fc

mod_adhoc_dataforms_demo: Fix duplicate field prevention It's supposed to only include each type of form field once per form at most but it didn't note which fields it had added already. No idea what the probability was anyways, probably pretty low.
author Kim Alvefur <zash@zash.se>
date Tue, 23 Jun 2020 19:40:55 +0200
parents 4fc6cf528a9a
children 1eb2b9483081
comparison
equal deleted inserted replaced
4048:64b7daa6c42c 4049:78f1de5301fc
152 for _ = 1, math.random(1, 5) do 152 for _ = 1, math.random(1, 5) do
153 local random 153 local random
154 repeat 154 repeat
155 random = math.random(2, #form); 155 random = math.random(2, #form);
156 until not already_selected[random] 156 until not already_selected[random]
157 already_selected[random] = true;
157 table.insert(current_form, form[random]); 158 table.insert(current_form, form[random]);
158 end 159 end
159 state.forms[state.step] = dataforms.new(current_form); 160 state.forms[state.step] = dataforms.new(current_form);
160 end 161 end
161 162