Time Nick Message 18:15 Krock j​osiah_wi: any success? 18:18 Krock #9417 easy review 18:18 ShadowBot https://github.com/minetest/minetest/issues/9417 -- Use "Aux" key name consistently by Wuzzy2 19:33 Andrey01 New PR #10471 19:33 ShadowBot https://github.com/minetest/minetest/issues/10471 -- Add `table.len` method. by Andrey2470T 19:37 Krock use-cases? 19:42 Andrey01 read the PR description 19:56 Krock I don't see any use-case there 19:56 Krock it's just demonstrating what the function does, not where it could effectively be used in mods 19:58 MTDiscord i overuse numerical keys because the # operator exists 19:59 Andrey01 I don`t know, I think elsewhere where getting of table length is used, it is difficult to say 20:00 Krock if length of the table matters, you'd use numeric indexing anyway. for non-numeric keys (mostly strings) you don't care about the amount 20:02 Andrey01 why do you say you don`t care about the amount? really are there not cases where you need to count amount of fields in an associative arrays? 20:03 MTDiscord There are definitely cases where you care about the amount but index by string because it will lookup faster. In such a case, it is best to have a length key that you increment when adding values. 20:04 Andrey01 just all problem in # operator is it will return incorrect count if counting is implemented in asscociative arrays 20:05 MTDiscord I dont think table.getn is deprecated in 5.1 (it is later though) so for Minetest specifically you can increment an n key yourself in a non-integer-indexed table, so table.getn will work on both your table and numerically indexed tables. 20:06 MTDiscord Or just make your own function to return table.n or #table 20:06 MTDiscord (probably the better option) 20:06 Andrey01 what is table.getn? 20:06 MTDiscord google is your friend 20:06 celeron55 i think it's good practice in Lua to not use a counting len() like that 20:07 Andrey01 here is no such method 20:07 Andrey01 https://www.lua.org/manual/5.4/manual.html#6.6 20:07 MTDiscord it doesnt exist in 5.4 20:08 MTDiscord https://www.lua.org/pil/19.1.html or https://www.google.com/search?q=table.getn&oq=table.getn&aqs=chrome.0.69i59.2164j0j1&sourceid=chrome&ie=UTF-8 20:09 MTDiscord regardless getn can be replaced with a oneliner functino 20:09 MTDiscord function* 20:10 MTDiscord But if you know the table you are working with has a length key, you dont even need a function 20:13 MTDiscord you can also give your table a metatable to count for you and return the value with the # operator 20:16 pgimeno if it is implemented, I would not call it len, maybe count 20:17 DS-minetest G​reenXenith: afaik, the # operator can't be overridden for tables 20:17 MTDiscord __len 20:19 pgimeno doesn't work for me 20:19 MTDiscord works for me 20:19 DS-minetest G​reenXenith: http://www.lua.org/manual/5.1/manual.html#2.8 see the elseif type(op) == "table" 20:19 pgimeno a=setmetatable({},{__len=function() return 9 end}) ; print(#a) gives 0 20:19 MTDiscord thats not how you use setmetatable 20:20 DS-minetest you can only override operators that would otherwise not work 20:20 MTDiscord a={}; setmetatable(a, {__len=function() return 9 end}); print(#a) 20:20 MTDiscord this works 20:20 pgimeno returns 0 for me 20:21 pgimeno are you sure you're using Lua 5.1? 20:21 DS-minetest http://www.lua.org/manual/5.1/manual.html#pdf-setmetatable setmetatable returns the first parameter 20:21 DS-minetest @G​reenXenith 20:22 DS-minetest seems to work for lua5.4 20:22 MTDiscord Yeah thats what ive just figured 20:22 MTDiscord Should work on 5.3 as well 20:22 MTDiscord Minetest should really update 20:22 pgimeno it is implemented in 5.2 20:22 MTDiscord BuT WhY wOuLD i EveR NeEd ThOSe FeATuReS?? 20:23 Andrey01 I think it would be better to use function, not overriding an operator 20:23 pgimeno LuaJIT is stuck at 5.1, and it's essential to run servers at a half-decent speed 20:23 MTDiscord the override operator is just for convenience 20:24 MTDiscord the underlying method is still incrementing a length key 20:24 pgimeno __len is implemented in LuaJIT with a compilation option, http://luajit.org/extensions.html (search __len in the page) 20:25 DS-minetest you could set __newindex in the metatable to increase n (first check if it was nil) 20:25 MTDiscord right 20:25 MTDiscord that part of the metatable is still valid 22:53 DS-minetest clipping of boxes doesn't seem to work anymore 22:54 sfan5 huh? 22:56 DS-minetest no wonder, #8676 sets the clip rect to nullptr 22:56 ShadowBot https://github.com/minetest/minetest/issues/8676 -- Add gradients and borders to FormSpec boxes by v-rob 23:07 DS-minetest made a fix: #10473 23:07 ShadowBot https://github.com/minetest/minetest/issues/10473 -- Fix box[]es not being clipped by Desour