[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Proposal: debug.topointer
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 28 Jul 2015 11:05:02 +0200
2015-07-28 5:45 GMT+02:00 Daurnimator <email@example.com>:
> In the faraway future, in whatever version of lua comes next:
> It'd be nice if lua_topointer was exposed to lua code.
> This would allow for users to get a unique value corresponding to a
> given object.
> Use cases:
> - __tostring metamethods that have previously needed a `rawtostring`
> (usually painstakingly created by removing the metatable and
> then replacing it)
> - common value for comparison by e.g. table.sort
For the first use case, I agree that `rawtostring` in the standard library
is very commonly needed. I don't want to hijack this thread, so I'll
enlarge on that in a fork.
For the second case, I would rather sort on the `rawtostring` values
which would group items of the same type together.