[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "namespaces and "constructor calls"
- From: Florian Weimer <fw@...>
- Date: Fri, 07 May 2010 13:42:29 +0200
* Christoph Schreiber:
> Hi again! I'm writing a lua wrapper for a chart package (Chart Director) in C++, and I'd like my users to write something like the following in their lua code:
>
> width = Chart.DefaultWidth
> height = Chart.DefaultHeight
>
> c = Chart.XYChart(width, height)
>
> I want to use "Chart" as a namespace and I would like the call to
> "XYChart.create" look like a constructor call. How can I achive
> that?
Did you mean to write "XYChart" instead of "Chart" somewhere?
I think you can achieve this by overriding the __call metamethod on
the table which implements the namespace.