Re: Proposal: debug.topointer
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Proposal: debug.topointer
- From: Philipp Janda <siffiejoe@...>
- Date: 2015年7月28日 06:42:06 +0200
Am 28.07.2015 um 05:45 schröbte Daurnimator:
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)
As an alternative, maybe we can have a new format specifier for
`string.format` that calls `lua_topointer` on its argument (`%p` is
still free I think) ...
- common value for comparison by e.g. table.sort
That wouldn't do much good, since light userdata don't have `<` defined
(and the C standard makes this operator difficult to implement).
Anyway, both use cases probably shouldn't depend on a debug function.
Philipp