Help With Implementing Object Classes in Lua


I'm working on a turn-based creature battler, but this is my first time using Lua and I'm a little confused on how to set up classes properly and use them later.

Currently, I'm setting up my monsters (referred to as familiars in game), as a class this way, but I feel like this isn't the correct way:

class('Familiar', { fstats = table.create(6, 0),
                    health = 100,
                    movesKnown = table.create(4, 0),
                    level = 1,
                    earnedXP = 0,
                    xpToLVL = 100 }).extends()

Then I created fstats and movesKnown as separate subclasses of Familiar:

class('fstats', { HP   = 10,
                  mATK = 10,
                  rATK = 10,
                  mDEF = 10,
                  rDEF = 10,
                  SPD  = 10 }).extends(Familiar)

class('movesKnown', { move1, move2, move3, move4 }).extends(Familiar)

But this seems like it's not correct, but I'm struggling to parse how this works and then how I would go about implementing it for individual monsters?

Thanks ahead of time for your help!

Or should I be doing something like this:


function Familiar:init(type, stats, currenthp, movesKnown, level, earnedxp, xptolevel)
    self["Type"] = type
    self["Stats"] = stats
    self["Health"] = currenthp
    self["MovesKnown"] = movesKnown
    self["Level"] = level
    self["EarnedXP"] = earnedxp
    self["XPtoNextLevel"] = xptolevel
    return self

I'm quite new to programming (I'm much more comfortable with scripting), so I'm really unsure what I'm doing here. If anyone has an ELI5 of this, that would be super appreciated!