[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Let's talk about __call
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 22 Jul 2016 07:48:02 -0300
> what do you use the __call metamethod for?
I don't actually use this but
getmetatable("").__call = string.sub
allows you to extract substrings with
s(3,5)
In my libraries, I use __call in only two, lgpc and lrandom, for convenient
access to polygon data in lgpc and to generate a random number in lrandom.
I wish I used __call more often. I hope to learn clever ways in this thread.
(Thanks Patrick for steering us back a useful thread!)