lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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!)