Time Nick Message 00:36 vejou woah is this real irc 00:36 vejou i made it! 00:37 [MatrxMT] lol my username pings myself 00:38 MTDiscord 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:27 bdju XMPP 02:21 swift110-mobile hey all 02:24 MTDiscord Scott here 04:21 [MatrxMT] SMS!? I'm not paying for international texting! 04:26 [MatrxMT] 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] so, the worst of all 3 worlds 07:17 MTDiscord 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: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:39 MTDiscord 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 Ideally you would not have an XYZ table which lacks the vector metatable to begin with 09:18 MTDiscord But if you do, and you want to convert it, vector.copy(t) is what you should do. 09:18 MTDiscord 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 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 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 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 To those who write core code, it's probably not unclear, but we modmakers only have the documentation and the wiki 09:26 MTDiscord 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 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 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 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 MTDiscord 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 for example: local function reflect(v, normal) return v - 2 * v:dot(normal) * normal end 09:42 MTDiscord 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:44 MTDiscord 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 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 Explanations like this should go to the wiki instead of my half-wit assumptions 😄 09:46 MTDiscord 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 forwarded* 11:19 MTDiscord 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 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 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:28 MTDiscord 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 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) 12:37 MTDiscord 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: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:27 MTDiscord Basically yes. You can also bake all possible clothes and hide all irrelevant geometry via scale=0 though. 16:31 [MatrxMT] How do you make a non guessable random number? 16:35 [MatrxMT] Use PcgRandom or math.random? 16:37 [MatrxMT] nvm, found SecureRandom 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: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] That could collide maybe 16:55 sfan5 you can also conside buying hundred lava lamps 16:55 [MatrxMT] 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] That's a bit too much I think 16:56 [MatrxMT] 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] Can't I use SecureRandom? 16:57 [MatrxMT] or is math.rnadom ok 16:57 [MatrxMT] for that 16:57 jonadab Yes, SecureRandom should be fine for that. 16:57 [MatrxMT] 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] Doesn't need to be secure, just not colliding i guess 16:58 [MatrxMT] 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] Oh, and is core available in older code? Or only minetest? 17:05 MTDiscord the core namespace has always existed even before the rename, minetest was simply an alias for it 17:41 MTDiscord 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 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 can make an idiot proof interface which takes a closure to limit the scope during which math.random is deterministic 17:45 MTDiscord 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:52 [MatrxMT] Can you leave a mod channel? 17:58 [MatrxMT] Nvm, found 18:49 [MatrxMT] How do I make a mod channel writeable? I can't send on client for some reaspn. 18:50 [MatrxMT] How do I make a mod channel writable? I can't send on client for some reason. 19:44 MinetestBot 02[git] 04sfan5 -> 03luanti-org/minetestmapper: Add a few more log messages 13458c3c3 https://github.com/luanti-org/minetestmapper/commit/458c3c30a0338bcb3cbc43f515fe667d8f75d487 (152025-03-12T19:41:20Z) 23:21 cheapie If anyone is still maintaining a misspellings list, I just saw "LLIUANTI" elsewhere