Is this related to the initial question? It’s not good to add new questions to a single-topic forum post… having said that:
local bob -- a local variable \_G.bill = 10 -- a global variable billy = 9 -- a global variable local function ted() -- local function end local function sue() -- global function end function susan() -- global function end ------------------------------------------------------------ ------------------------------------------------------------ local obj = {} -- A Table obj.myName = "Bud" -- A user-defined field/property on a table function obj.doit() -- A user-defined function on a table. print("HI") end obj.doit() -- Calling the function function obj.doit2( self ) -- Another user-defined function (with explicit self as first argument) on a table. print("Hi, my name is", self.myName ) end obj.doit2() -- doit2( obj ) called as a function obj:doit2() -- doit2() called as a method function obj:doit3( ) -- A user-defined method (implied self as first argument) on a table. print("Hi, my name is", self.myName ) end obj.doit3() -- doit3( obj ) called as a function obj:doit3() -- doit3() called as a method ------------------------------------------------------------ ------------------------------------------------------------ local circ = display.newCirlce(0,0,100) -- A display object circ.myName = "Bud" -- A user defined field/property on a display object. function circ.doit() -- A user defined function on a display object. print("HI") end circ.doit() -- Calling the function function circ.doit2( self ) -- Another user defined function (with explicit self as first argument) on a display object. print("Hi, my name is", self.myName ) end circ.doit2() -- doit2( circ ) called as a function circ:doit2() -- doit2() called as a method function circ:doit3( ) -- A user defined method (implied self as first argument) on a display object. print("Hi, my name is", self.myName ) end circ.doit3() -- doit3( circ ) called as a function circ:doit3() -- doit3() called as a method