[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: First impressions and errata
- From: "Gary V. Vaughan" <gary@...>
- Date: Mon, 24 Feb 2014 12:46:38 +1300
On Feb 24, 2014, at 10:55 AM, Anders Petersson <firstname.lastname@example.org> wrote:
> Interesting how 'require' can change the behavior of standard functions. Will look closer into stdlib.
This is easy to do in Lua, although (even in the case of stdlib) probably not a good idea for a large project that needs to maintain good separation of concerns. The trick is simply to override the core `tostring` function, which the interpreter calls on the argument to an `=` call from the interactive command line.
Stdlib uses a few other dirty tricks, albeit to make using Lua much more convenient. But, I'm slowly re-engineering them to be cleaner between releases, and already it's much cleaner than it was this time last year, with only `require "std"` and a couple of other outliers changing the core functionality of Lua in the current incarnation.
Gary V. Vaughan (gary AT vaughan DOT pe)
Description: Message signed with OpenPGP using GPGMail