Re: Basic concepts of OOP
Posted: Thu Feb 16, 2012 6:10 pm
thelinx wrote:You just define enemy.add as
...
waraiotoko wrote: Agreed!
Code: Select all
function enemy:add(args)
local enemy = {}
enemy.race = args.race or "Human"
enemy.hp = args.hp or "15"
enemy.weapon = args.weapon or "Dagger"
table.insert (enemies,enemy)
end