Time Nick Message 05:41 ANAND #7587 works again, yay! 05:41 ShadowBot https://github.com/minetest/minetest/issues/7587 -- Implement on_wielditem_change callback registration by ClobberXD 05:42 ANAND PR is now much simpler 05:42 ANAND It's also ready for review (testing code in first post) 09:48 ANAND Is there an alternative to FATAL_ERROR_IF that doesn't require an error message? 09:48 ANAND assert only works in debug mode, apparently 09:49 sfan5 sanity_check 09:49 sfan5 the condition is inverted obviously 09:50 ANAND Thanks, will try it out 10:10 ANAND Getting the following assertion failure on latest master: minimal/mods/test/player.lua:13: assertion failed! 10:10 ANAND I didn't explicitly do "make clean", but I'm sure all C++ files were re-compiled. 10:11 ANAND Will try make clean in a bit 10:24 sfan5 works for me 10:33 ANAND Strange, I'm almost sure all the C++ files were recompiled... make clean should solve my issue then. Sorry for the trouble. 10:33 ANAND #9864 10:33 ShadowBot https://github.com/minetest/minetest/issues/9864 -- [no squash] Lua API: Add boolean method ItemStack:compare by ClobberXD 11:16 sfan5 ANAND: what is the reasoning that check_meta defaults to false? 11:19 sfan5 also you cannot directly return a boolean from a lua method, that this works at all is a mystery 12:09 PGimeno you can't? 12:10 sfan5 not like this https://github.com/minetest/minetest/pull/9864/files#diff-c2ff8edadb83582d8d6257e09b07ff1eR197 12:10 PGimeno ah from the C++ side 12:11 PGimeno right, you return how many items are returned 12:13 ANAND sfan5: I assume that mods would usually compare itemstacks without wanting to compare meta 12:17 ANAND Btw, thanks for pointing out the quirk. I'm guessing that works by implicitly converting the boolean to an integer? 12:17 PGimeno "To return values to Lua, a C function just pushes them onto the stack, in direct order (the first result is pushed first), and returns the number of results." 12:18 ANAND How that'd be passed to the stack still remains sketchy - I don't know why I wrote that code :) 12:18 ANAND I'll use pushboolean instead 12:18 PGimeno it will return zero or one values, and if the one value happens to evaluate to true, it will work 12:18 sfan5 ANAND: but why? if the metadata is different it's not really the same item 12:20 ANAND It doesn't have to be the same item - the method can be used to compare the only main data values of two stacks. 12:21 ANAND ... or does that not make much sense? 12:21 ANAND I'm guessing that doesn't, lol 12:21 sfan5 the question is: how often do you want "are these items of the same kind (but also the wear is identical)?" instead of "is this 100% the same item?" 12:22 ANAND Yeah, that was the original idea, and I *assumed* mods might want to check for the former more often than the latter. 12:23 sfan5 I don't know the reasons for mods to compare items, but in the engine item code it's always "are these literally the same items so they can be stacked?" 12:24 ANAND True, that's why I added a separate function to compare stacks while ignoring meta 12:26 ANAND Let me know if I should enable meta-comparison by default 12:26 ANAND Or should I remove the option to ignore meta altogether? 12:28 sfan5 would be better IMO 12:28 sfan5 when you don't want to compare for strict equality it's better to have the modder think about what exactly he wants to compare 12:29 ANAND sfan5: Which one? :P 12:29 sfan5 ? 12:30 ANAND I assume you're supporting removal of the option altogether? 12:31 sfan5 yes 13:16 ANAND Ok, I'll remove it. You have a good point. 13:21 ANAND Now that there's no itemstack comparison sans meta, the unittest seems to be a bit overkill. Should it remain, or should it be removed? 13:21 sfan5 a quick test of the == operator suffices (haven't looked at the code) 13:21 ANAND IMO, there's no harm in adding unit-tests 13:22 ANAND sfan5: Yeah, that's what the revised unittest would look like :) 13:28 ANAND Hmm, I've removed only the compareWithoutMetadata UASSERTs, and the rest of the code still seems valid to me. Isn't it better to just leave the checks to be thorough? 13:29 ANAND I mean, I don't see the == operator "breaking" in any way, but it's good to be thorough anyway, I suppose? 13:32 ANAND Getting this warning while compiling: src/client/mapblock_mesh.cpp:926:6: warning: ‘waving’ may be used uninitialized in this function 13:42 ANAND sfan5: #9864 has been updated 13:42 ShadowBot https://github.com/minetest/minetest/issues/9864 -- [no squash] Lua API: Add boolean method ItemStack:compare by ClobberXD 13:42 ANAND Metadata is always compared now 13:46 ANAND Tested again using both unittest and chat-command; works as expected 17:05 Krock will push MTG patch in 10 minutes: https://krock-works.uk.to/u/patches/0001-Carts-Reset-player-view-and-attachment-table-on-deat.patch 17:14 Krock pushing...