Minetest logo

IRC log for #minetest-dev, 2021-03-30

| Channels | #minetest-dev index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:04 don_flymoor joined #minetest-dev
00:15 kilbith joined #minetest-dev
00:16 kilbith https://github.com/minetest/minetest/blob/master/src/irrlicht_changes/CGUITTFont.h#L37
00:16 kilbith ack?
00:33 don_flymoor joined #minetest-dev
00:34 kilbith joined #minetest-dev
01:33 specing_ joined #minetest-dev
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
03:37 Wuzzy joined #minetest-dev
04:00 MTDiscord joined #minetest-dev
04:40 absurb joined #minetest-dev
04:42 Fixer joined #minetest-dev
06:19 Kimapr1 joined #minetest-dev
06:24 Kimapr joined #minetest-dev
06:50 hlqkj joined #minetest-dev
07:44 Kimapr1 joined #minetest-dev
08:00 ShadowNinja joined #minetest-dev
08:54 ivanbu joined #minetest-dev
09:39 sfan5 pgimeno: so mods can tell which rotations are valid? I guess
09:39 calcul0n_ joined #minetest-dev
10:10 calcul0n__ joined #minetest-dev
10:20 pgimeno yes, exactly
10:22 pgimeno oops, missed this:
10:22 pgimeno <sfan5> pgimeno: the default metatables lua has are on strings, correct?
10:22 pgimeno <sfan5> 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
10:37 olliy joined #minetest-dev
11:04 tech_exorcist joined #minetest-dev
11:15 Kimapr joined #minetest-dev
11:49 proller joined #minetest-dev
11:51 appguru joined #minetest-dev
11:52 MTDiscord <appguru> sfan5: why should that not make sense?
11:53 MTDiscord <appguru> 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 <appguru> yes
11:55 MTDiscord <appguru> 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 <appguru> you could do getmetatable(table).__call = function(self, tab) return setmetatable(tab, {__index = self}) end)
11:56 MTDiscord <appguru> and then tab = table{k = v, ...}
11:58 MTDiscord <appguru> 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 <appguru> 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 <appguru> 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 <appguru> ah, you need to use debug.setmetatable
12:01 MTDiscord <appguru> I think your example is off
12:02 MTDiscord <appguru> 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 <appguru> oh you can
12:02 MTDiscord <appguru> the default metatable just throws an error
12:02 sfan5 hm that'd make sense
12:02 MTDiscord <appguru>  > debug.setmetatable(0, {__index = math}) > (0):floor() >
12:03 MTDiscord <appguru> which is neat, but relying on debug.* functions seems kinda hacky...
12:05 MTDiscord <appguru> now this got me wondering: what if I set __add for the string metatable?
12:05 pgimeno good question
12:06 MTDiscord <appguru> doesn't work
12:07 MTDiscord <appguru> wait, it does actually work!
12:07 MTDiscord <appguru> Except if using number strings
12:07 MTDiscord <appguru>  > (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 <appguru> automatic conversion to number is probably one of the dirtier parts of Lua
12:11 MTDiscord <appguru> excuse me now, I'll be setting metatables on functions
12:13 kilbith joined #minetest-dev
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] <kilbith> 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 <irrUString.h> does
12:24 pgimeno what
12:24 kilbith irrUString.h belongs to irrlicht now
12:25 sfan5 <irrUString.h> 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 <appguru> sfan5 wait
12:34 MTDiscord <appguru> that feature flag could be misleading; isn't degrotate applied clientside?
12:34 sfan5 definitely
12:34 MTDiscord <appguru> so 5.5 clients would have 1.5 deg steps and 5.4 clients 2 deg steps
12:34 MTDiscord <appguru> 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
12:46 DS-minetest joined #minetest-dev
13:01 kilbith joined #minetest-dev
13:25 Wuzzy joined #minetest-dev
13:31 specing_ joined #minetest-dev
14:17 ircSparky joined #minetest-dev
14:17 ircSparky joined #minetest-dev
14:23 hlqkj joined #minetest-dev
14:30 ronoaldo joined #minetest-dev
15:47 systwi joined #minetest-dev
16:22 numzero joined #minetest-dev
17:20 tech_exorcist joined #minetest-dev
17:21 appguru joined #minetest-dev
17:24 tech_exorcist joined #minetest-dev
18:04 Fixer joined #minetest-dev
18:15 don_flymoor joined #minetest-dev
18:37 proller joined #minetest-dev
19:12 Seirdy joined #minetest-dev
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
19:44 don_flymoor joined #minetest-dev
19:47 absurb joined #minetest-dev
21:33 proller joined #minetest-dev
21:34 don_flymoor joined #minetest-dev
22:09 don_flymoor joined #minetest-dev
22:37 Jordach joined #minetest-dev
22:39 Lunatrius` joined #minetest-dev
22:40 cheapie_ joined #minetest-dev
22:41 tsadok joined #minetest-dev
22:41 unclouded_ joined #minetest-dev
22:42 Calinou_ joined #minetest-dev
22:42 Taoki joined #minetest-dev
22:43 tech_exorcist joined #minetest-dev
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

| Channels | #minetest-dev index | Today | | Google Search | Plaintext