lua-users home
lua-l archive

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


On Tue, Jun 16, 2015 at 6:57 PM, 书呆彭, Peng Yi <nerditation@outlook.com> wrote:
在 2015/6/16 23:42, Andrew Cagney 写道:
Hi,

I'd like to change the behaviour of __eq when applied to strings.  I
suspect I'll need to somehow change the underlying string type?

<...>

Anyway, does anyone have a pointer or example showing how to do
override __eq (and string operations more generally).

meta-method in Lua is not a mechanism to override but as a fallback.

__len() would disagree. Unless you meant __eq specifically, but then I think we're getting into a semantic argument, and I'm not sure we would be arguing different things, really. 

--
Brigham Toskin