lua-users home
lua-l archive

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


2015-07-28 5:45 GMT+02:00 Daurnimator <quae@daurnimator.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.