Here is a skeleton class you can extend
local bot = {} local bot\_mt = {\_\_index = bot} local function start(self) --do something with this bot end local function stop(self) --do something with this bot end function bot:new(x,y,...) local newBot = {} //set properties of bot based on parameters based newBot.x, newBot.y = x, y //declare functions for bot newBot.start = start newBot.stop = stop return setmetatable( newBot, bot\_mt ) end return bot
Now you can create multiple instances of bot - in this case we will spawn 100 of them
local bots = {} for i = 1, 100 do local aNewBot = bot:new(i,i) bots[#bots+1] = aNewBot end
You can also reference them individually
bots[25]:start() bots[71]:stop()