I'm new to object oriented programming, and I got a constructor function from the official Lua website. The problem is, when I run this in a Script, it errors, saying that self is nil.
local Account = {}
function Account:new (o)
o = o or {} -- create object if user does not provide one
setmetatable(o, self)
self.__index = self --Error, self is nil?
return o
end
return Account
Maybe object oriented programming is different in Roblox.

1 comment
this forum post explains the boilerplate code that is needed for object oriented programming pretty well: https://devforum.roblox.com/t/all-about-object-oriented-programming/8585