Time Nick Message 00:16 kilbith https://github.com/minetest/minetest/blob/master/src/irrlicht_changes/CGUITTFont.h#L37 00:16 kilbith ack? 01:38 pgimeno sfan5: shouldn't #7840 include a minetest.features entry? 01:38 ShadowBot https://github.com/minetest/minetest/issues/7840 -- Degrotate support for mesh nodes by numberZero 09:39 sfan5 pgimeno: so mods can tell which rotations are valid? I guess 10:20 pgimeno yes, exactly 10:22 pgimeno oops, missed this: 10:22 pgimeno pgimeno: the default metatables lua has are on strings, correct? 10:22 pgimeno the only* 10:22 pgimeno yes 10:22 sfan5 right 10:22 sfan5 thanks for confirming 10:22 sfan5 I coded setmetatable({}, {__index = table}) earlier but it turns out that doesn't make sense 10:28 pgimeno about 7840, here's an example why minetest.features should be updated: https://irc.minetest.net/minetest-dev/2021-03-27#i_5803798 11:52 MTDiscord sfan5: why should that not make sense? 11:53 MTDiscord if you did that, you could do tab:insert(thing) instead of table.insert(tab, thing), which is a bit neater 11:54 sfan5 the metatable is only applied to that one empty table object, not to all tables 11:54 MTDiscord yes 11:55 MTDiscord you'd wrap that snippet in a function 11:55 sfan5 the metatable is only applied to that one empty table object, not to all tables 11:55 sfan5 but I thought it'd apply to all tables, which it doesn't 11:55 sfan5 uh 11:55 sfan5 that repeated messsage was supposed to be "sure you can do that" 11:56 MTDiscord you could do getmetatable(table).__call = function(self, tab) return setmetatable(tab, {__index = self}) end) 11:56 MTDiscord and then tab = table{k = v, ...} 11:58 MTDiscord but yes, there's no default metatable for tables, IIRC only strings have one 11:58 pgimeno I wrote a metatables tutorial that goes into all kinds of gory details: https://codeberg.org/pgimeno/Gists/src/branch/lua--metatable-tutorial 11:58 sfan5 not only that there is none, you cannot set a default metatable for tables 11:58 sfan5 (right?) 11:58 MTDiscord right. 11:58 pgimeno right 11:59 pgimeno "Whether it is associated to a value or to a type depends on the type. Every table and (full) userdata object can have its own metatable, therefore in that case it applies to each value independently. However, when setting the metatable of a number, all numbers will share the same metatable, and the same happens with the string, function, light userdata, thread, boolean and nil types, hence it applies to the type (or to all values of that 11:59 pgimeno type, if you prefer)." 11:59 MTDiscord oh, numbers have metatables? 11:59 pgimeno details in the link above :) 11:59 pgimeno e.g. they can, but they won't obey __add and stuff 12:00 MTDiscord ah, you need to use debug.setmetatable 12:01 MTDiscord I think your example is off 12:02 MTDiscord when doing setmetatable(something, mt), you won't be able to index mt, you have to set {__index = mt} as metatable for that 12:02 sfan5 last time I tried you can't index numbers so metatables would be pointless 12:02 MTDiscord oh you can 12:02 MTDiscord the default metatable just throws an error 12:02 sfan5 hm that'd make sense 12:02 MTDiscord > debug.setmetatable(0, {__index = math}) > (0):floor() > 12:03 MTDiscord which is neat, but relying on debug.* functions seems kinda hacky... 12:05 MTDiscord now this got me wondering: what if I set __add for the string metatable? 12:05 pgimeno good question 12:06 MTDiscord doesn't work 12:07 MTDiscord wait, it does actually work! 12:07 MTDiscord Except if using number strings 12:07 MTDiscord > (getmetatable"").__add = function() return "hello world" end > print("a" + "b") hello world > print("1" + 1) 2 > print(1 + "1") 2 > print("1" + "1") 2 12:08 pgimeno yeah, automatic conversion to number overrides it 12:10 MTDiscord automatic conversion to number is probably one of the dirtier parts of Lua 12:11 MTDiscord excuse me now, I'll be setting metatables on functions 12:14 kilbith so nobody has noticed the error I pointed out yesterday? 12:19 pgimeno if you mean this, it's likely that people were sleeping: 12:19 pgimeno [0330 02:16:13] https://github.com/minetest/minetest/blob/master/src/irrlicht_changes/CGUITTFont.h#L37 12:21 sfan5 update irrlicht, the header moved there 12:22 pgimeno that's the advantage of submodules, they reference a specific version 12:23 kilbith jeez man 12:23 kilbith #include "irrUString.h" won't work 12:24 kilbith #include does 12:24 pgimeno what 12:24 kilbith irrUString.h belongs to irrlicht now 12:25 sfan5 would be more correct but our CI has zero issues with it 12:25 kilbith pulled last night and it caused a compilation error 12:26 kilbith until I changed to <> 12:27 sfan5 I'll prepare a PR with this and some other changes I just noticed 12:28 sfan5 pushing http://sprunge.us/2rfVcl?diff in 5m 12:28 pgimeno sounds like you're using a non-standard-compliant compiler, "..." should retry the search in the same place as <...> if it isn't found in whatever additional places it looks 12:33 pgimeno https://stackoverflow.com/a/3162067 contains a quote of the standard 12:33 MTDiscord sfan5 wait 12:34 MTDiscord that feature flag could be misleading; isn't degrotate applied clientside? 12:34 sfan5 definitely 12:34 MTDiscord so 5.5 clients would have 1.5 deg steps and 5.4 clients 2 deg steps 12:34 MTDiscord a serverside mod can't just use either 12:34 sfan5 we don't have per-client feature flags so this is the best modders get 12:35 sfan5 (not like those would help anyway) 12:35 pgimeno I'd prefer degrotate_steps = 240, so that one can use e.g. steps = minetest.features.degrotate_steps or 180 12:36 sfan5 that might be convenient but minetest.features is defined to only contain booleans 12:36 pgimeno hm, degrotate_240 = true then maybe? 12:36 pgimeno I don't like names with 'new', because they can become old and then confusing 12:39 sfan5 I'll go with degrotate_240_steps 12:40 pgimeno sounds good 19:36 sfan5 merging #10764, #11137, #11138 in 12m 19:36 ShadowBot https://github.com/minetest/minetest/issues/10764 -- Consistent title bar + render information in mainmenu by SmallJoker 19:36 ShadowBot https://github.com/minetest/minetest/issues/11137 -- Block & report player self-interaction by appgurueu 19:36 ShadowBot https://github.com/minetest/minetest/issues/11138 -- Draw items as 2D images (instead of meshes) when possible by sfan5 23:46 sfan5 I think we need a full-time person to review my PRs ;) 23:46 sfan5 or maybe some fancy AI can do it