Luanti logo

IRC log for #luanti, 2025-03-12

| Channels | #luanti index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:36 vejou joined #luanti
00:36 vejou woah is this real irc
00:36 vejou i made it!
00:37 [MatrxMT] <vejou> lol my username pings myself
00:38 MTDiscord <vejou> three platforms!
00:43 vejou the real cross platform channel is this one then
00:43 vejou i mean i guess this is really the only cross platform place
00:44 vejou what else could you even add? SMS?
00:44 vejou Revolt?
01:18 SwissalpS joined #luanti
01:27 bdju XMPP
01:34 SwissalpS joined #luanti
01:44 SwissalpS joined #luanti
01:56 SwissalpS joined #luanti
02:16 SwissalpS joined #luanti
02:17 Trifton joined #luanti
02:19 Helenah joined #luanti
02:21 swift110-mobile hey all
02:24 MTDiscord <greenxenith> Scott here
03:03 sparky4 joined #luanti
03:22 fling_ joined #luanti
03:33 SwissalpS joined #luanti
03:47 sunflr joined #luanti
03:58 sunflr joined #luanti
04:00 MTDiscord joined #luanti
04:21 [MatrxMT] <Blockhead256> SMS!? I'm not paying for international texting!
04:26 [MatrxMT] <Blockhead256> truly cross-platform, but if you post a discord image, the link will die within 24 unless you're on discord to refresh the token
04:26 [MatrxMT] <Blockhead256> so, the worst of all 3 worlds
05:27 diemartin joined #luanti
05:49 Meli joined #luanti
06:58 bodicceaII joined #luanti
07:17 MTDiscord <bastrabun> What's the correct way to make a real vector out of a table like {x=5, y= 10, z = -9} ? Asking, because lua_api.md?plain=1#L3928 is not clear on whether vector.new({x=5, y= 10, z = -9}) is deprecated or not
08:18 sfan5 don't you mean vector.copy?
08:19 sfan5 and yes only the vector.new(x, y, z) form is *not* deprecated
08:26 Frutinha joined #luanti
08:30 Frutinha Hello! what are the supported ubuntu LTSs?
08:31 Frutinha I was trying to build a personal appimage for it, but i not sure how old ubuntu i can use for building, i try 16 and 18, but no success
08:34 germ joined #luanti
08:37 FileX joined #luanti
08:39 MTDiscord <bastrabun> No, I specifically mean what is the MT way of making a real vector from the wellknown and everywhere in use format {x=5, y= 10, z = -9}. If only the format vector.new(x,y,z) is allowed, then I need to unpack the table and do vector.new(pos.x, pos.y, pos.z), right? That's the MT way to do it?
09:16 MTDiscord <luatic> Ideally you would not have an XYZ table which lacks the vector metatable to begin with
09:18 MTDiscord <luatic> But if you do, and you want to convert it, vector.copy(t) is what you should do.
09:18 MTDiscord <luatic> This will still support the deprecated XYZ vector format for the foreseeable future if not forever (it's literally more work to not allow arbitrary XYZ tables with duck typing) as it would just be too nasty and just not really worth it (yet?) to do anything about it.
09:20 MTDiscord <bastrabun> There is no advantage in having the old format without metatable. I don't see what advantage the new format would have, but that's a different story. MT wants me to have "real" vectors, so I want to have real vectors. local real_vector_with_metatable = vector.copy({x=5, y= 10, z = -9}) is how MT wants me to convert tables to vectors?
09:21 MTDiscord <bastrabun> I'm about to write a lot of stuff that involves vectors and I want to do it "right" (or at least the MT way) from the start.
09:22 FileX joined #luanti
09:22 celeron55 i'm not sure if it's still unclear, but yes, vector.copy is the proper way to add the metatable
09:24 celeron55 and if you're making a vector out of literals or separate coordinate variables, then vector.new
09:25 MTDiscord <bastrabun> To those who write core code, it's probably not unclear, but we modmakers only have the documentation and the wiki
09:26 MTDiscord <bastrabun> Still, my question was answered and I now know which way to do it
09:27 celeron55 feel free to post an issue or PR about it. people working on the docs might or might not be reading this
09:30 MTDiscord <bastrabun> If I have a suggestion how to properly word it: Sure, will. In such cases I often assume I'm the only dummy who is unable to understand it properly, especially if no one else asked before me.
09:37 celeron55 in this case, what probably happens with most modders is they try a couple of things and stick to the one that happens to work, regardless of any documentation. which is of course results in everyone having to do that as nobody ever fixes the docs
09:39 MTDiscord <luatic> Bastrabun: note that as celeron said, if you already have the variables / literals / expressions for x, y, z, prefer vector.new, so vector.new(5, 10, -9).
09:40 MTDiscord <luatic> but if you already have the table, say you're using a library which is still using the table format, do vector.copy(t) to get a copy with the metatable.
09:40 dibesfer joined #luanti
09:40 MTDiscord <luatic> the advantage of the new format is said metatable. it makes operations on vectors a good bit nicer; you can just write out vector operations like in math and call methods using :method.
09:41 MTDiscord <luatic> for example: local function reflect(v, normal) return v - 2 * v:dot(normal) * normal end
09:42 MTDiscord <luatic> is, while a bit less explicit, much nicer than function reflect(v, normal) return vector.subtract(v, vector.multiply(2 * vector.dot(v, normal), normal)) end if you ask me.
09:43 dibesfer joined #luanti
09:44 MTDiscord <luatic> this also enables reuse of algorithms: say you have a function which sums a non-empty list of things using +. with the vector metatable, the very same function will work for a list of vectors just as well as for numbers.
09:45 MTDiscord <luatic> another example would be the formula t * a + (1-t) * b for linear interpolation. this will also work on vectors and numbers alike with the vector metatable.
09:45 MTDiscord <bastrabun> Explanations like this should go to the wiki instead of my half-wit assumptions 😄
09:46 MTDiscord <luatic> forward some pointers to #luanti-docs-irc. maybe someone else (or i in two weeks when i feel like writing docs again) will pick it up :juanchi_face:
09:46 MTDiscord <luatic> forwarded*
09:47 fluxionary_ joined #luanti
10:45 SliverFlowCipher joined #luanti
11:00 FileX joined #luanti
11:19 MTDiscord <bastrabun> Now I have a variable a. This variable a may or may not be a vector in the table format. It might be nil, it might also be {}. I can't do vector.check(a), because it is obviously not yet a real vector yet. I also can't to vector.copy(a), because vector.copy will cry if I hand it anything but a vector-like table. What's the most reasonable way of checking whether something qualifies as vector table?
11:20 MTDiscord <bastrabun> Sure I could check for the existence of a.x and a.y and a.z and then typecheck and ... but is that the way to go?
11:22 MTDiscord <mark.wiemer> I'd make a custom isVector function that checks against nil, {}, and if those pass, then use vector.check, but I'm no expert
11:25 Frutinha joined #luanti
11:28 MTDiscord <bastrabun> IMO vector.copy should return nil, if passed an invalid vector. currently it only crashes
11:49 celeron55 i'd argue the one that would return nil should be a separate function name, like try_copy
11:50 celeron55 it's better to crash early than force everyone to have to cope with nils even if they don't want to
11:51 celeron55 (and, maybe try_copy is niche enough that you should just implement it yourself)
11:53 MTDiscord <bastrabun> Sure, I did that now - it's just a question of what's the preferred MT way. I very much doubt that no one else has the need to know whether a variable could be a legit vector or not. Means, every modmaker would implement the same function over and over. (Some better, some worse even)
11:53 celeron55 i'd say, again, post an issue on github. people will add reactions and comments to the issue and you will find out whether people think the same
11:54 celeron55 (the alternative is probably to post a poll on some high traffic discord channel, but the result of that will probably be missed by core devs)
11:56 ashtray joined #luanti
12:01 ireallyhateirc joined #luanti
12:09 erstazi joined #luanti
12:12 ashtray left #luanti
12:27 Leopold joined #luanti
12:36 TheSilentLink joined #luanti
12:37 MTDiscord <mark.wiemer> My takeaway is that there's no "preferred" way in the sense that Luanti has any strong opinion. If it works and isn't deprecated, it's good to go 🙂 yes, there will be some duplication of minor functions, but that's relatively common when working with frameworks. Fortunately these functions, like is_vector, are very small! And echoing c55, issues on GitHub are a good way to track things
12:41 celeron55 i think people fear local small functions way too much. every alternative to those tends to be worse in one way or another. this doesn't mean commonly used ones shouldn't be added to core or published as modding libraries, but the first instinct of a programmer should be to just make the function. that is the best choice in terms of productivity
12:44 ireallyhateirc small functions are actually reusable if you can copy them and slightly change them, unlike e.g. objects with a mountain of inheritance resembling a house of cards
12:46 celeron55 small functions, once not needed anymore, can be easily refactored out by first changing them into wrappers and finally doing serach & replace through a codebase. they add very minimal complexity
12:51 ireallyhateirc it really bugs me why people use inheritance which breaches encapsulation and ruins modularity instead of simply using object of one class in an object of another
12:52 ireallyhateirc big OOP APIs of projects like Blender or Godot are hard to read because sometimes a function you need is 4 layers of inheritance below the class you're using
13:01 FileX joined #luanti
13:06 mikewilzn joined #luanti
13:07 ireallyhateirc Luanti question: say I have a rigged 3D character and rigged clothes made for that character. To swap clothes I'd need to attach each clothing item to the root bone?
13:08 ireallyhateirc I can export the character together with clothes as one mesh which would work but that would make clothes unswappable
13:23 SliverFlowCipher joined #luanti
13:27 MTDiscord <luatic> Basically yes. You can also bake all possible clothes and hide all irrelevant geometry via scale=0 though.
13:33 MTDiscord1 joined #luanti
13:36 FileX joined #luanti
13:51 jistr joined #luanti
14:34 TheCoffeMaker joined #luanti
14:37 fluxionary_ joined #luanti
14:51 ireallyhateirc joined #luanti
14:53 mikewilzn left #luanti
14:56 mikewilzn joined #luanti
14:59 mikewilzn left #luanti
15:00 mikewilzn joined #luanti
15:05 mrkubax10 joined #luanti
15:52 kamdard joined #luanti
16:19 SFENCE joined #luanti
16:31 [MatrxMT] <Bracket> How do you make a non guessable random number?
16:35 SFENCE_ joined #luanti
16:35 [MatrxMT] <Bracket> Use PcgRandom or math.random?
16:37 [MatrxMT] <Bracket> nvm, found SecureRandom
16:37 fluxionary_ joined #luanti
16:38 Krock you can guess all RNG's. The hit rate might be quite low, though
16:39 sfan5 https://xkcd.com/221/
16:39 jaca122 joined #luanti
16:49 Krock heh
16:55 jonadab Concatenate something that is never the same twice (the current datetime will do if you get it from a reliable source like GPS or ntp) with some piece of difficult-to-predict public information that changes often (e.g., a stock index), and salt it with a kilobyte or so that you keep absolutely secret.  Then run the result through a cryptographically secure one-way hash function.
16:55 jonadab The absolutely secret info can be the same every time as long as the one-way hash is cryptographically secure.
16:55 [MatrxMT] <Bracket> That could collide maybe
16:55 sfan5 you can also conside buying hundred lava lamps
16:55 [MatrxMT] <Bracket> I want multiple clients to get a code
16:56 sfan5 (https://www.cloudflare.com/de-de/learning/ssl/lava-lamp-encryption/)
16:56 jonadab Probability of collision is a property of which hash function you use.
16:56 [MatrxMT] <Bracket> That's a bit too much I think
16:56 [MatrxMT] <Bracket> I'm trying to use modchannels to give every client a diffrent channel
16:57 jonadab I mean, if this is for game purposes, you can probably just live with the operating system's random library if it's a decently modern OS.
16:57 [MatrxMT] <Bracket> Can't I use SecureRandom?
16:57 [MatrxMT] <Bracket> or is math.rnadom ok
16:57 [MatrxMT] <Bracket> for that
16:57 jonadab Yes, SecureRandom should be fine for that.
16:57 [MatrxMT] <Bracket> Thank you.
16:57 jonadab Or math.random for that matter I would imagine.
16:57 jonadab How secure you need to be really does depend on what you're doing.
16:58 [MatrxMT] <Bracket> Doesn't need to be secure, just not colliding i guess
16:58 [MatrxMT] <Bracket> Are there any benefits of using math.random over SecureRandom?
16:59 jonadab If there are, they're not security related.  Could be performance reasons?  Dunno.
17:03 [MatrxMT] <Bracket> Oh, and is core available in older code? Or only minetest?
17:05 MTDiscord <rollerozxa> the core namespace has always existed even before the rename, minetest was simply an alias for it
17:08 Trifton_ joined #luanti
17:41 MTDiscord <luatic> yes, math.random has unbeatable performance. it should be your go-to for "non"deterministic random that doesn't need to be incredibly secure.
17:42 sfan5 but please don't actually call math.randomseed
17:42 MTDiscord <luatic> well if you reseed with a seed obtained based on the previous seed it's fine, probably
17:43 sfan5 that's easy to accidentally forget
17:44 MTDiscord <luatic> can make an idiot proof interface which takes a closure to limit the scope during which math.random is deterministic
17:45 MTDiscord <warr1024> that closure thing is how I did deterministic RNG for Piranesi for a while.  I think I went back to using SHA1 at some point because I wanted the algo to be easier to repro outside of lua.
17:46 Trifton_ joined #luanti
17:52 [MatrxMT] <Bracket> Can you leave a mod channel?
17:54 diemartin joined #luanti
17:55 SFENCE joined #luanti
17:58 [MatrxMT] <Bracket> Nvm, found
18:16 dibesfer joined #luanti
18:27 kamdard joined #luanti
18:33 Talkless joined #luanti
18:40 SFENCE joined #luanti
18:44 SFENCE joined #luanti
18:48 SFENCE joined #luanti
18:49 [MatrxMT] <Bracket> How do I make a mod channel writeable? I can't send on client for some reaspn.
18:50 [MatrxMT] <Bracket> How do I make a mod channel writable? I can't send on client for some reason.
19:41 SFENCE joined #luanti
19:44 MinetestBot [git] sfan5 -> luanti-org/minetestmapper: Add a few more log messages 458c3c3 https://github.com/luanti-org/minetestmapper/commit/458c3c30a0338bcb3cbc43f515fe667d8f75d487 (2025-03-12T19:41:20Z)
19:51 SFENCE joined #luanti
19:54 SFENCE joined #luanti
20:14 pattmax joined #luanti
20:14 pattmax joined #luanti
20:21 SFENCE joined #luanti
20:38 Verticen joined #luanti
20:38 silverwolf73828 joined #luanti
20:54 SFENCE joined #luanti
20:58 SFENCE joined #luanti
21:10 SFENCE joined #luanti
21:32 SFENCE joined #luanti
21:57 SFENCE joined #luanti
22:04 Kimapr joined #luanti
22:32 mikewilzn left #luanti
22:35 SFENCE joined #luanti
22:51 swee joined #luanti
22:51 imi joined #luanti
22:53 SFENCE joined #luanti
23:21 cheapie If anyone is still maintaining a misspellings list, I just saw "LLIUANTI" elsewhere
23:37 panwolfram joined #luanti
23:43 SwissalpS joined #luanti

| Channels | #luanti index | Today | | Google Search | Plaintext