Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Methods

Brad Sharp edited this page Nov 26, 2016 · 2 revisions

Methods are functions which can be called on your an object of your class, the parameters given are the object followed by the parameters the method was called with.

local class = require'class'

local planet = class {
    Mass = 0;
    GetGravitationalForce = function (this, distance)
        return (this.Mass * 6.67e-11) / (distance * distance)
    end;
}
Clone this wiki locally