lua-users home
lua-l archive

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


在 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