[LuaDoc] mathx.random_choice can return nil if the input list is empty

This commit is contained in:
Celtic Minstrel 2024-02-04 16:30:31 -05:00
parent 121f0a3cac
commit e644613cae

View file

@ -5,7 +5,7 @@ print("Loading mathx module...")
---@param possible_values string|table Either a comma-separated list of values (which can contain integer ranges like 2-7)
---or an array of possible values (which can also contain integer ranges as subtables with {lo, hi} elements)
---@param random_func? fun(a:integer,b:integer):number
---@return number|string
---@return number|string|nil
function mathx.random_choice(possible_values, random_func)
random_func = random_func or mathx.random
assert(type(possible_values) == "table" or type(possible_values) == "string",