Time Nick Message 17:13 Krock will merge game#2637 in 10 minutes (trivial) 17:13 ShadowBot https://github.com/minetest/minetest_game/issues/2637 -- trees: Reduce local variables. by orbea 17:14 Krock > tnt is not registered if disabled 17:14 Krock ??? just disable the explosive parts in this case 17:15 Krock it could still be interesting for decorations 17:35 Krock merging 22:17 DS-minetest #9612 22:17 ShadowBot https://github.com/minetest/minetest/issues/9612 -- Add a metatable for vectors by Desour 22:18 * DS-minetest hopes that this change will come into 5.3 22:20 DS-minetest using operators and the : syntax on vectors is a real treat 22:28 sfan5 hm 22:30 sfan5 I'm a little wary of moving to array vectors but the way you implemented it looks perfectly backwards-compatible 22:32 DS-minetest I'm wondering if doing something like `local xyz = {x=1, y=2, z=2} local k = xyz[key] if k then return v[k] end` in __index would be faster than using multiple ifs 22:34 sfan5 doubt it 22:53 p_gimeno hash vectors was one of the worst design decisions, if they can be mixed with array vectors for compatibility and dropped in future that would be awesome 22:56 p_gimeno that would require deprecating hashes 22:56 DS-minetest but I like the .x syntax 23:01 DS-minetest I'd also like hash_node_position and to_string / from_string to be moved into vector 23:06 p_gimeno you can do e.g. local x, y, z = 1, 2, 3 then use a[x], a[y], a[z] 23:06 p_gimeno I'd suggest to use indices in vector.lua, for performance 23:07 p_gimeno (in the PR) 23:08 DS-minetest that's not possible because of backwards compatibility 23:09 DS-minetest (I could use different functions in the metatable and in vector though) 23:13 p_gimeno in vector.add, all ELSEs are unnecessary 23:13 p_gimeno but they probably don't hurt performance 23:16 p_gimeno PR looks good 23:20 p_gimeno there's a remote possibility that a mod uses the vector as a table (a hack, or inadvertently) but in that case, fix'em 23:21 sfan5 code that does such things probably isn't using vector.new() 23:21 sfan5 but still backwards compat is not easily dismissed 23:21 DS-minetest uh oh, p_gimeno you're right 23:22 DS-minetest I could remove the error calls to allow such bad practice 23:22 sfan5 if that's easily doable then please do so 23:22 sfan5 what happens though if a mod then iterates the table.. 23:22 p_gimeno if they use both the hash and array parts, then there isn't anything you can do to fix it 23:22 sfan5 I guess you need to convert the table into an old-style vector as soon as you notice the mod doing funny stuff 23:23 p_gimeno oh good point, next() (aka pairs()) doesn't work 23:23 DS-minetest I'll have to test what table.compare (or whatever the name is) and pairs() do 23:24 DS-minetest (pairs could get overridden) 23:24 p_gimeno it will return indices 1, 2, 3 instead of x, y, z 23:24 DS-minetest right 23:25 p_gimeno you should override next() which is the underlying function used by pairs (I don't use pairs at all in my code) 23:25 DS-minetest mhm 23:26 DS-minetest oh, there is no deep table.compare 23:26 p_gimeno I think this change might be better for 6.0, keeping the errors and warning about the incompatibility 23:26 DS-minetest also, what does core.serialize and json do 23:27 sfan5 p_gimeno: prepare to wait until 2024 then 23:27 p_gimeno heh maybe 23:27 sfan5 DS-minetest: don't forget to add test for all the backwards compat 23:27 sfan5 tests* 23:29 rubenwardy yeah, please update the unit tests 23:47 DS-minetest haha, it seems like assert.same uses next