Posted 12 July 2012 - 11:11 AM
Can I define classes in LUA?
function pass()
return read("*")
end
print("enter your password")
password = pass()
print("your password is: "..password )
Can I define classes in LUA?
MyMathClass = {
Add = function (A, :)/>/>
return A + B
end,
Subtract = function(A, B)/>/>
return A - B
end
}
print(MyMathClass.Add(1, 2)) -- prints 3
print(MyMathClass.Subtract(20, 5)) -- prints 15
person["doStuff"](person, place)
person.doStuff(person, place)
person:doStuff(place)
That last line is starting to look like an object method invocation, right?