[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: tostring userdata (was: Problem with closures, nCcalls on Lua 5.4.0 (alpha))
- From: Tom Sutcliffe <tomsci@...>
- Date: Sun, 30 Jun 2019 11:28:57 +0100
On 28 Jun 2019, at 8:58 pm, Tom Sutcliffe <tomsci@me.com> wrote:
>
> I've rebuilt from https://github.com/lua/lua/commit/05ba2880491fa1ecfe78d8a3542edcd6220e4022 and the entire test suite is now passing except for one test relating to GCing of userdatas, which I'll look in to further when the weekend isn't rapidly approaching/overdue.
I've tracked this down to the fact that the test - not the production code :) - was relying on the tostring representation of a full userdata 0xABCD being the same as the lightuserdata representation of the same pointer - they were both "userdata: 0x1234" on 5.3 but on 5.4 the userdata is now formatted as "MyUserData: 0x1234" (where the userdata's metatable's __name is "MyUserData")
I couldn't find anywhere in the manual that this was mentioned - in particular __name is mentioned solely in the docs for luaL_newmetatable which states "The entry __name is used by some error-reporting functions" - and this change has broadened the scope of what __name is used for. I realise that the exact formatting of tostring is not defined in the API but previously changes like that of tostring(2.0) in 5.3 were at least mentioned in the "Changes in the Language" section - could we do the same here?
The good news is my unit tests are now passing 100% on 5.4 (at commit 05ba2880491fa1ecfe78d8a3542edcd6220e4022).
Cheers,
Tom