Say I want to have a CatManager class that allows me create cats and keep track of them. In other languages I often use singletons for this type of thing. I would like to create a cat like this:
local CatManager = require("CatManager")
CatManager:createCat("Morris")[/code]
How would I go about creating the CatManager class?
[code]module(..., package.seeall)
function createCat(id)
print("creating cat: " .. id)
end
Error: “attempt to concatenate local ‘id’ (a table value)”
[import]uid: 52127 topic_id: 9415 reply_id: 309415[/import]
[import]uid: 5833 topic_id: 9415 reply_id: 34443[/import]