Code: Select all
local p = 0.025
local ret = {}
for x, name in ipairs({"A", "B", "C"}) do
ret[x] = {
item = name,
probability = x * p,
}
end
log("ret: " .. serpent.block(ret))
Code: Select all
ret: {
{
item = "A",
probability = 0.025
},
{
item = "B",
probability = 0.05
},
{
item = "C",
probability = 0.075000000000000009
}
}