[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: overriding string __eq as in: if {} == "string"
- From: 书呆彭, Peng Yi <nerditation@...>
- Date: Wed, 17 Jun 2015 09:57:07 +0800
在 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.
The objective here is to fully integrate my objects into Lua.
I don't exactly know your use case, but I guess you might want
to consider userdata; userdata is normally for users to create
custom data types.
--
the nerdy Peng / 书呆彭 / Sent from Thunderbird