BanksySan
(David)
September 1, 2023, 6:21pm
1
I have two files in different directories that have a class called FooBar
. How can I import these both into a file?
My guess is using the optional namespace
parameter in the class
function. The docs mention it but don't give any indication of how to use it.
Could anyone give me an example?
Gamma
September 1, 2023, 7:30pm
2
I dug into corelibs last weekend because I wanted to figure out namespaces, they appear to be a table. So in your files you could make some global tables to hold them:
NamespaceOne = {}
class("FooBar", nil, NamespaceOne).extends()
----
NamespaceTwo = {}
class("FooBar", nil, NamespaceTwo).extends()
Then you'd instantiate them with NamespaceOne.FooBar()
and NamespaceTwo.FooBar()