Random Construction in Task Queues

Some games have multiple tier 1 factories, such as vehicles versus walkers. We might want Shard to randomly choose which type of units to use. This is how to make Shard choose a random unit from a list to build in a task queue:

--[[
 Task Queues!
]]--

math.randomseed( os.time() )
math.random(); math.random(); math.random()

function randomLab()
	local r = math.random(0,2)
	if r == 0 then
		return "corlab"
	elseif r == 1 then
		return "corvp"
	else
		return "corap"
	end
end

local corecommanderlist = {
	"corsolar",
	"cormex",
	"corsolar",
	"cormex",
	"cormex",
	randomlab,
	"corllt",
	"corrad",
	"corsolar",
	"corsolar",
	"corsolar",
	"corsolar",
	"corsolar",
	"cormex",
	"cormex",
	"cormex",
	"corllt",
	"corsolar",
}
taskqueues = {
	-- unittype = tasklist,
	corcom = corecommanderlist
}