[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Most awesome string metatable hack
- From: Andrew Starks <andrew.starks@...>
- Date: Fri, 31 Jan 2014 06:32:48 -0600
On Friday, January 31, 2014, steve donovan <steve.j.donovan@gmail.com> wrote:
On Fri, Jan 31, 2014 at 9:52 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> If the suggestiion that __call for strings should be squandered on simulating
> printf
That was my thought - so many better ways to use __call (like sub?).
And ultimately, it's a global modification. I used to think this was
harmless, but eventually even simple error messages on string types
start to get confusing. Now, if we could do this kind of hack _per
environment_ (however that be defined) then we're cooking; a person's
experiments remain private idiosyncrasies.
So I guess my sense of humour didn't boot up fast enough ;)
Hmmm. Let me try again:
Hey, I thought up a neat hack and after a quick search failed to turn up a prior discussion about it, I thought I'd post it here:
(See above)
I find myself typing `("some %s"):format(var_name) ` so often that this seemed like something worth trying out for a while.
I don't think that this should be in Lua. I don't miss printf. Your ideas about __call and the string metatable are equally valid and interesting to me.
Still too (un)funny?
-Andrew