c would be the DB if I am correct. (not sure if this the correct format for rewriting that piece of code, but it might help you understand it) if you do DB:Connect("dbname", "dbuser", "dbpassword", "dbhost", 3306) then you are really doing DB.Connect(DB,"dbname", "dbuser", "dbpassword", "dbhost", 3306)
function DB.Connect(self,DBName, DBUser, DBPass, DBAddr, Port )
-- so self is actually the DB table
require "luasql.mysql"
self.env = assert( luasql.mysql() )
self.con = assert(self.env:connect(DBName, DBUser, DBPass, DBAddr, Port))
end
Disclaimer: I do not fully understand this part of lua yet, so I may have made a mistake.