Minetest logo

IRC log for #minetest, 2021-02-13

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

All times shown according to UTC.

Time Nick Message
00:09 galex-713 joined #minetest
01:02 Boingo joined #minetest
01:15 Boingo joined #minetest
01:19 Gustavo6046 no
01:19 Gustavo6046 it's on right click
01:31 gg54 joined #minetest
01:32 gehhbfbfhbj joined #minetest
01:36 gw1 joined #minetest
02:36 Lunatrius joined #minetest
02:41 garywhite joined #minetest
03:14 alex-resist joined #minetest
03:29 leo_rockway joined #minetest
04:53 erlehmann joined #minetest
05:00 MTDiscord joined #minetest
06:00 Boingo joined #minetest
06:52 Boingo joined #minetest
07:22 AndDT joined #minetest
07:28 FeXoR joined #minetest
07:54 Boingo joined #minetest
08:00 ShadowNinja joined #minetest
08:15 FeXoR1 joined #minetest
08:16 ssieb joined #minetest
08:38 clavii joined #minetest
08:41 jetter joined #minetest
08:49 rschulman joined #minetest
08:49 antoine62[m] joined #minetest
08:49 jgibbons[m] joined #minetest
08:49 Pie-jacker875 joined #minetest
08:49 Ruud joined #minetest
08:49 Fusl joined #minetest
08:52 systwi_ joined #minetest
08:52 ^arcade_droid joined #minetest
08:52 __vy joined #minetest
08:52 heavygale joined #minetest
08:52 JackFrost joined #minetest
08:52 tuedel joined #minetest
08:52 jetter joined #minetest
08:52 erlehmann joined #minetest
08:52 dabbill joined #minetest
08:52 bwarden joined #minetest
08:52 Out`Of`Control joined #minetest
08:52 Glorfindel joined #minetest
08:52 basxto joined #minetest
08:52 iamweasel joined #minetest
08:56 Peppy joined #minetest
08:56 Quiark joined #minetest
08:56 kyuss joined #minetest
08:56 sfan5 joined #minetest
08:56 sknebel joined #minetest
08:56 Ritchie joined #minetest
09:01 jess joined #minetest
09:01 ShadowBot joined #minetest
09:01 jonadab joined #minetest
09:01 jomat joined #minetest
09:24 anuke[m] joined #minetest
09:24 dalz joined #minetest
09:24 Yves[m]1 joined #minetest
09:24 big_caballito[m] joined #minetest
09:24 sonomicheleya[m] joined #minetest
09:24 anon5[m] joined #minetest
09:24 Link[m] joined #minetest
09:32 rschulman joined #minetest
09:35 Corey[m] joined #minetest
09:35 Vagabond[m] joined #minetest
09:35 giov4[m] joined #minetest
09:36 ullnrr joined #minetest
09:38 bhree[m] joined #minetest
09:39 Zughy[m]1 joined #minetest
09:39 xose[m] joined #minetest
09:40 majochup joined #minetest
09:45 appguru joined #minetest
10:11 calcul0n_ joined #minetest
10:15 tech_exorcist joined #minetest
10:16 LoneWolfHT joined #minetest
10:19 soloojos[m] joined #minetest
10:20 Danny[m] joined #minetest
10:20 Newbyte joined #minetest
10:25 jgibbons[m] joined #minetest
10:25 antoine62[m] joined #minetest
10:27 jfred[m] joined #minetest
10:28 [m]testman joined #minetest
10:29 Quiark joined #minetest
10:30 Noclip joined #minetest
10:30 mikitte[m] joined #minetest
10:32 silwol joined #minetest
10:32 kb1000 joined #minetest
10:32 khimaros[m] joined #minetest
10:32 tuxayo[m] joined #minetest
10:32 FrostRanger[m] joined #minetest
10:35 alex-resist joined #minetest
10:38 rschulman joined #minetest
10:39 ullnrr joined #minetest
10:43 bhree[m] joined #minetest
10:45 sonomicheleya[m] joined #minetest
10:46 Link[m] joined #minetest
10:46 Corey[m] joined #minetest
10:46 anon5[m] joined #minetest
10:46 big_caballito[m] joined #minetest
10:46 Yves[m]1 joined #minetest
10:46 anuke[m] joined #minetest
10:47 giov4[m] joined #minetest
10:47 Zughy[m]1 joined #minetest
10:47 dalz joined #minetest
10:47 xose[m] joined #minetest
10:47 Vagabond[m] joined #minetest
10:52 sfan5 Gustavo6046: you cannot use "latest git" of minetest_game with 5.3.0 of the engine
10:53 freshreplicant[m joined #minetest
11:11 Talkless joined #minetest
11:17 Lunatrius` joined #minetest
11:21 Sven_vB joined #minetest
11:21 Lunatrius joined #minetest
11:47 numzero joined #minetest
11:54 FeXoR joined #minetest
12:10 MTDiscord <L​emente> > you can use !tell sokomine <message> if the user isn't online @appguru thanks, I'll try that!
12:14 MTDiscord <L​emente> !tell sokomine hey! I made a few textures in the rpg16 style for your mid cottages. I was also thinking about making a PR for your mod. I made all the wooden nodes flammable. I was also thinking about cleaning the textures names. And since I can easily do palette swap in my textures, I could support more roof types.
12:15 MTDiscord <L​emente> (us this how it works?)
12:15 MTDiscord <L​emente> is*
12:23 MTDiscord <a​ppguru> @Lemente unfortunately that only works from IRC
12:23 galex-713 joined #minetest
12:24 MTDiscord <L​emente> Well, at least I tried 😄
12:25 MTDiscord <L​emente> Will it work if I rename myself /tell sokomine ? 😅
12:38 Fixer joined #minetest
13:16 Wuzzy joined #minetest
13:20 Krock @L​emente just propose a PR
13:27 MTDiscord <L​emente> I guess that's what I'll do, thanks!
13:40 alex-resist joined #minetest
13:43 MTDiscord <c​oging> what's the IRC channel tag?
13:48 Krock #minetest
13:57 olliy joined #minetest
14:02 SwissalpS joined #minetest
14:15 fleeky_ joined #minetest
14:48 Gustavo6046 joined #minetest
14:59 nly joined #minetest
15:00 nly how can i call a command from lua "/give nly mcl_tools:axe_diamond" for example?
15:01 nly ofc, i need more than axe
15:02 sfan5 if it's the give comand it'd be easier to just reproduce its functionality
15:02 rubenwardy yeah, better to use the Lua API for that - see add_item in InvRef
15:02 rubenwardy !book inv
15:02 MinetestBot rubenwardy: ItemStacks and Inventories - https://rubenwardy.com/minetest_modding_book//en/items/inventories.html
15:02 sfan5 generally it's minetest.registered_chatcommands["give"].func("name_of_the_player_who_is_executing_the_command", "nly mcl_tools:axe_diamond")
15:14 nly thanks
15:15 calcul0n__ joined #minetest
15:17 nly whats a concise syntax to add items to a iTemstack?
15:20 Krock nly: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L5975
15:21 Krock ^ for Inventories
15:21 Krock https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L6069-L6070  <-- for itemstack alone
15:41 jetter joined #minetest
15:48 Gustavo6046 funn!
15:48 Gustavo6046 :D
15:56 nly http://paste.debian.net/1185339/
15:56 nly
15:56 nly
15:56 nly whats wrong here?
15:56 Krock lua uses ~  rather than !
15:57 Krock and arrays start at index 1
15:58 nly input:1: '(' expected near 'loop' on https://www.lua.org/cgi-bin/demo
15:59 Krock what's loop?
15:59 nly function name
16:00 Krock and what's remove?
16:00 nly table.remove
16:00 MTDiscord <W​arr1024> What language is that code in?  Looks like pseudocode...
16:00 Krock so use table.remove  and call loop like a function
16:00 Krock i.e.  loop(table.remove(arg, 1)
16:00 Krock )
16:00 MTDiscord <W​arr1024> table.remove?  First arg would have to be a table
16:01 MTDiscord <W​arr1024> what you've got is ..., which is a lua bare list
16:01 Krock local arg = {...}   does the trick
16:01 MTDiscord <W​arr1024> you need at least something like local arg = {...} to pack it into a table if you want to manipulate it that way
16:01 Krock inja0d
16:01 Krock ninja'd
16:01 MTDiscord <W​arr1024> but you'd frankly be better off just leaving it as ...
16:02 Krock but ... cannot be indexed that easily and counting the number of full stops isn't practical either
16:02 MTDiscord <W​arr1024> local function loop(first, ...) if first ~= nil then return "" else return first .. loop(...) end end
16:03 MTDiscord <W​arr1024> Also, the function doesn't make sense to me in the first place.
16:03 nly can i trouble you for paste?
16:04 MTDiscord <W​arr1024> For instance m("a", "b") should always return empty string since "a" is never nil, and m() would always recurse forever because the first arg will always be nil.
16:04 MTDiscord <W​arr1024> Looks like a backwards implementation of string concatenation as a tail-recursive function.
16:04 Krock also you're defining "loop" and "m" in the same line. weird syntax but apparently okay
16:05 MTDiscord <W​arr1024> yeah, that's also bad style because m is local but loop is apparently global
16:05 MTDiscord <W​arr1024> local function concat(first, ...) return first == nil and "" or (first .. concat(...)) end
16:06 MTDiscord <W​arr1024> Thus concat("a", "b", "c") should return "abc".
16:07 anuke[m] dont
16:07 MTDiscord <W​arr1024> Of course people never actually do this because just using the .. operator makes more sense, and this is only actually useful when you're working with incoming variadics.
16:07 Krock basically re-inventing table.concat
16:07 anuke[m] table.concat has not awful performance
16:07 MTDiscord <W​arr1024> well, sorta.  It skips the process of stuffing ... into a table.
16:07 anuke[m] using .. reallocates many times
16:07 Krock anuke[m]: I'm pretty sure this is for educational purposes
16:08 anuke[m] oh good
16:08 MTDiscord <W​arr1024> Ah, and of course, it's not possible to have a conversation that involves string concatenation without someone sharing that old misconception about slow vs fast string concat.
16:08 anuke[m] its not a misconception
16:08 MTDiscord <W​arr1024> If this were a low-level language like C, where the use of dumb naive string concat is effectively specified by the language then that advice would make sense.
16:09 anuke[m] since you already know its "a", "b", "c" just say table.concat{"a", "b", "c"}
16:09 MTDiscord <W​arr1024> Of course, part of the misconception is that the misconception is not a misconception.
16:09 anuke[m] allocate 4 slots in the hashmap and concat
16:09 anuke[m] rather than multiple reallocs
16:09 MTDiscord <W​arr1024> If you already know it's "a", "b", and "c" then obviously "a".."b".."c" runs in O(0) time.
16:10 anuke[m] does luac concat literals at compile-time?
16:10 MTDiscord <W​arr1024> the string concat operator is generally faster than table concatenation in HLLs, especially JITted ones, because it avoids the work of constructing a table.
16:10 MTDiscord <a​ppguru> In LuaJIT it has pretty much the same performance
16:10 MTDiscord <a​ppguru> At least according to the few benchmarks I ran
16:11 anuke[m] thats fair, im used to traditional lua vm
16:11 MTDiscord <W​arr1024> Generally the correct answer as to "which is faster" is "you'll need to test it on the target runtime implementation to know for sure."
16:11 anuke[m] yes testing now
16:11 MTDiscord <W​arr1024> Because modern string concat is often NOT done by buffer copying.
16:11 MTDiscord <a​ppguru> in traditional Lua concat will be faster for many strings
16:12 MTDiscord <W​arr1024> Strings are internally stored as ropes while they're being constructed and only baked down to strings as necessary, so i.e. the build-into-table-then-table.concat thing is effectively done in native code and thus is faster if you don't try to do it yourself.
16:13 MTDiscord <W​arr1024> A given Lua implementation may or may not actually do this under the hood, but for example V8 JS definitely does, and JS has almost the exact same string semantics that Lua does, other than the aggressive interning (which I think is merely unspecified, not anathema, in JS).
16:13 MTDiscord <a​ppguru> Lua strings are unique
16:13 MTDiscord <a​ppguru> V8 optimizations don't apply to them
16:14 qj joined #minetest
16:14 MTDiscord <W​arr1024> You mean the strings themselves are unique as a consequence of interning, or you mean that the fact that they are interned makes Lua's string logic unique?
16:14 MTDiscord <a​ppguru> they are unique
16:14 MTDiscord <a​ppguru> string comparison is constant time IIRC
16:14 MTDiscord <W​arr1024> Yes, that's what I was asking
16:15 MTDiscord <a​ppguru> which means whenever you're creating a new string it has to check whether it's already present to return the existing adress if possible
16:15 MTDiscord <a​ppguru> so if you concat strings, this is theoretically done after each concat operator
16:15 MTDiscord <a​ppguru> if you concat a table, it is only done once
16:15 MTDiscord <W​arr1024> No, they don't have to do that at string creation, they only need to do that when you're creating a string reference that will later be read.  Interning can be skipped for intermediate strings.
16:15 MTDiscord <a​ppguru> Yes
16:16 MTDiscord <a​ppguru> LuaJIT optimizes this
16:16 MTDiscord <a​ppguru> for PUC Lua, table concat used to be recommended though
16:16 MTDiscord <a​ppguru> IDK if that has changed with 5.3 or 5.4...
16:16 MTDiscord <W​arr1024> So if you do local a = "" for i = 1, 100 do a = a .. i end return a then only the final value of string a actually needs to be interned.  This means that a can exist as a rope during the bulk of this method and thus it should run faster than using the alternative table.concat.
16:17 MTDiscord <W​arr1024> Kinda makes me curious about how PUC vs. JIT stack up on that sort of function.
16:18 MTDiscord <W​arr1024> The most correct way to optimize string concat is to not optimize string concat, and never put yourself in a situation where you'd have to worry about it.  The second best way is to do what makes the most sense and balances readability for the most common case, and then don't worry about it unless you have evidence of a perf problem later.
16:18 MTDiscord <W​arr1024> In this case I think doing the .. concat operator probably makes the most sense.
16:18 MTDiscord <a​ppguru> Currently doing start = os.time(); str = ""; for i = 1, 1000000 do str = str .. i end; print(os.time() - start) in PUC Lua and it's horribly slow
16:20 MTDiscord <W​arr1024> I wouldn't mandate JIT absolutely, but I'd avoid optimizing for PUC specifically, especially at the cost of JIT, because I'd expect JIT to be the primary use-case.
16:21 kamdard joined #minetest
16:21 MTDiscord <W​arr1024> All in all string concat is one of those things that gets WAY more attention than it deserves in the balance of things, and there's always someone who chimes in with "X is wrong, Y is the right way" and completely misses both the nuance of how actual implementations handle it, and the fact that if you're gonna have a serious perf drag in your code, there's a good chance string handling is not your culprit.
16:22 * anuke[m] sent a long message:  < https://matrix.org/_matrix/media/r0/download/matrix.org/iTTetmOuqWecnLhmhzwTeHNs/message.txt >
16:22 MTDiscord <a​ppguru> table.concat returns almost immediately for that benchmark
16:22 MTDiscord <a​ppguru> so yes, it appears to still make a big difference
16:22 MTDiscord <W​arr1024> Like, if you remember the leftpad debacle in the JS world, when you look at how leftpad was implemented, it was actually interesting because that leftpad implementation was distinctly optimized.
16:22 anuke[m] indeed it does
16:23 anuke[m] in lua5.3 .. is 500x slower than concat with a single string repeated
16:23 MTDiscord <a​ppguru> oof
16:23 MTDiscord <a​ppguru> for me, the concat benchmarks both haven't even completed yet
16:23 anuke[m] aaaaaaaaaaaaaa
16:23 MTDiscord <a​ppguru> despite only construing < 10 MB strings
16:23 anuke[m] i have to compile my time thing for luajit
16:23 anuke[m] or else no microsecond time
16:23 MTDiscord <W​arr1024> It's well established that PUC lua doesn't optimize basically anything, and with JIT being the de facto standard across languages today, PUC should be considered more of a reference implementation than an actual real-world one.
16:24 anuke[m] yes
16:24 anuke[m] im going to test in a min
16:24 MTDiscord <a​ppguru> well, the LuaJIT one hasn't exited either, to my surprise
16:24 MTDiscord <W​arr1024> If LuaJIT effs this up too then I guess it would just go to show how far behind the Lua world is as a general-application language overall.
16:24 MTDiscord <a​ppguru> which is weird, as I specifically remember doing this and it being really fast
16:24 MTDiscord <W​arr1024> I think strings-as-ropes was a 1990's thing.
16:25 MTDiscord <W​arr1024> so anyone still doing naive strings 20 years later in an HLL seems weird
16:26 MTDiscord <W​arr1024> Again, if you actually HAVE to do this optimization, though, then you've probably already done something wrong.
16:26 anuke[m] why wouldnt you want to repeat a string 1 million times in lua
16:26 MTDiscord <a​ppguru> that number doesn't seem that big
16:26 anuke[m] i want to be able to get the .. result
16:26 anuke[m] instead of having to ^C it
16:26 MTDiscord <W​arr1024> The most efficient way to repeat a string SHOULD be to double it repeatedly, then truncate it to the correct length.
16:26 MTDiscord <a​ppguru> it probably won't matter regarding Minetest
16:27 anuke[m] ok wow
16:27 anuke[m] table.concat is noticably faster than string.rep?
16:27 MTDiscord <W​arr1024> I'm fairly sure that there's nothing specified in the language itself that dictates which method should be fastest, like the way low-level C strings do, so the fastest way should just match the language-independent standard.
16:27 * anuke[m] sent a long message:  < https://matrix.org/_matrix/media/r0/download/matrix.org/jebgifglhOQVMrnQaupqPhsB/message.txt >
16:27 anuke[m] takes 12 seconds with luajit ..
16:28 anuke[m] ah
16:28 MTDiscord <W​arr1024> srsly?  That's F'd up.
16:28 anuke[m] yes
16:28 anuke[m] not such a misconception after all
16:28 * anuke[m] sent a long message:  < https://matrix.org/_matrix/media/r0/download/matrix.org/tFOJhOOtnvzkOmAuYsSXSPMf/message.txt >
16:28 anuke[m] for reference this is my test code
16:29 MTDiscord <W​arr1024> Anyway, it's certainly a misconception that manually building a list of strings and then doing a big concat at the end is faster, it's just apparently ALSO a misconception that concepts in string handling since the 90's also apply to Lua.
16:30 MTDiscord <W​arr1024> On some level it's a little surprising, but on another, I guess Lua probably does a lot less string manip than other languages, so maybe it makes sense in context.
16:30 anuke[m] ah i fixed a thing
16:30 anuke[m] table.concat is actually 2x slower than c
16:30 anuke[m] and not just an empty loop
16:31 MTDiscord <W​arr1024> Try it using V8 and I think you'll see some surprises.
16:31 MTDiscord <W​arr1024> Frankly, if someone could coopt V8 to run untranspiled Lua that would probably be a big speed boost, though the C crossover stuff would be a mess, so I'm not surprised it hasn't happened yet.
16:32 MTDiscord <W​arr1024> Then again, I guess with stuff like nodejs, JS already has its own native interfaces, so maybe it shouldn't be TOO hard?
16:33 anuke[m] >v8
16:33 anuke[m] >any kind of c interop
16:33 anuke[m] this is why lua is great
16:34 MTDiscord <W​arr1024> nodejs definitely does C interop decently, or else that whole "it's singlethreaded so you can only use 1 CPU core" thing would be true too.
16:35 MTDiscord <W​arr1024> In nodejs, the JS is mostly just used as dispatch coordination between native calls, and you can spend like 99% of your time in native calls running in background threads.
16:35 anuke[m] yeah now try to write is-true in c and youll see why lua is king
16:35 anuke[m] :P
16:36 MTDiscord <W​arr1024> Lua was arguably better designed for this kind of work earlier on, but JS has had so much mindshare thrown at it that it's evolving fast and has probably leapfrogged Lua in many of these regards.
16:36 MTDiscord <W​arr1024> JS type coercion is a train-wreck, sure, but people who do JS day-to-day have mostly formed scar tissue around that particular blob of pus.
16:37 MTDiscord <W​arr1024> It's not like Lua never made a mistake they regretted and then tried to back out in a later version of the language (ahem setfenv) but then had trouble getting their community to accept it (everyone still using 5.1)
16:38 anuke[m] luajit not being ported to 5.3/4*
16:42 rubenwardy `..` is noticably slower than table.concat
16:44 adfeno joined #minetest
16:44 MTDiscord <W​arr1024> Yes, that's what we concluded.
16:45 adfeno Hi, I installed climate_api regional_weather, pova, and player_monoids in v7 mapgen and can`t move.
16:45 MTDiscord <W​arr1024> The problem is that you shouldn't ASSUME that string concat operators will be slower than array-concat constructs, because that's an anacrhonism.
16:45 adfeno I can only jump.
16:49 anuke[m] in v8 using join is 2x faster than + concatenation loop
16:49 * anuke[m] uploaded an image: Screenshot_16:49:23.png (16KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/yMEOyEoYIyhokaTofupCJemL/Screenshot_16:49:23.png >
16:49 MTDiscord <W​arr1024> The problem I was trying to point out was that people think that the concat operator being slow is a fundamental property of strings.  Someone inevitably offers this advice regardless of language or implementation.  The problem is that it's NOT fundamental and DOES vary between contexts.  That makes it a misconception to me, even if it can sometimes be right when applied to a specific context.
16:50 anuke[m] yes
16:50 anuke[m] know thy implementation
16:50 anuke[m] its always slower on lua5.3
16:50 anuke[m] til its slower on jit
16:50 anuke[m] with 10m iterations it takes 3.3 seconds with +, 1.6s with join
16:51 anuke[m] actually its somehow 3800x slower on luajit
16:52 MTDiscord <W​arr1024> Haha, wow, apparently string handling gets pretty weird under the hood.  Example from the JS world where they also mention a comparison to Lua: https://stackoverflow.com/questions/6551918/javascript-string-concatenation-speed
16:54 MTDiscord <W​arr1024> Either way, if you're doing a minetesty thing in Lua, and you're having problems with string concat speed that are actually impacting your thing, then I'm really wondering what that thing is.  There just isn't all that much use of strings in MT that will have notable performance impact unless you find a way to do something really really wrong.
16:54 MTDiscord <W​arr1024> Don't forget the first 2 rules of Lua optimization from https://www.lua.org/gems/sample.pdf
16:55 anuke[m] yeah
16:55 anuke[m] when would you need to concat more than like 4 strings
16:55 anuke[m] for formspecs use neither concat nor .., use string.format
16:55 Krock string.format and table.concat
16:57 Krock based on execution time it really does not matter for so few and short string operations
16:57 MTDiscord <W​arr1024> I find .. more readable than string.format when you have relatively sporadic variable interpolation, since string.format relies on argument position.
16:57 nly thanks
16:57 anuke[m] yeah
16:58 anuke[m] .. is perfectly fine when you have few strings
16:58 MTDiscord <W​arr1024> Ultimately if I had to do a lot of formspec construction I'd prefer to use abstract helpers, but I get a lot more value out of avoiding that problem than trying to solve it.
16:58 nly how would you go about doing multiple addItem to ItemStack?
16:58 anuke[m] multiple calls
16:58 anuke[m] stack.addItem(...)
16:58 anuke[m] stack.addItem(...)
16:59 Krock no
16:59 Krock :add_item
16:59 MTDiscord <W​arr1024> when adding items to a stack or inv, it's often important to remember to pay attention to the residuals returned.
16:59 anuke[m] doesnt matter if you use : or not
16:59 Krock or stack.add_item(item, .......)
16:59 anuke[m] addItem is nil
16:59 MTDiscord <W​arr1024> if you're adding 3 stacks together it's possible that you get a result that doesn't fit in fewer than 3 stacks.
16:59 anuke[m] true that
16:59 anuke[m] how to lose items in 1 simple step
16:59 anuke[m] powered by not checking for overflow
17:00 nly https://srfi.schemers.org/srfi-1/srfi-1.html#FoldUnfoldMap
17:00 Krock oh no scheme
17:00 * Krock hides
17:00 nly map, fold anyone?
17:01 MTDiscord <W​arr1024> nly: if you've got a LISP background, then you might wanna check out the Fennel language, which is a LISP dialect that transpiles into Lua.  I haven't tried it myself yet, but it's on my list, and at least one significant Lua project (the Loria game I think?) uses it.
17:01 MTDiscord <W​arr1024> Yeah, here it is https://github.com/forked-from-1kasper/loria
17:01 MTDiscord <W​arr1024> A Minetest game written in a LISP dialect.
17:02 rubenwardy inv:add_item("main", ItemStack({ name = "default:dirt", count = 32 }))
17:03 MTDiscord <W​arr1024> Adding items to inventories makes things easier than trying to add them to stacks directly and then getting/setting stacks in an inventory.  The only limitation is that you can't control how things are packed into inventories; they always occupy the first available space.
17:03 anuke[m] pro memory microptimisation tip: 1. store {} 2. store ItemStack since im 99% sure all userdata has to be allocated on the heap by lua
17:03 MTDiscord <W​arr1024> And in all cases you need to remember to check for the "carry" stack in the return value, and do something sane with it.  If all inventories are full you can just add it to the world as an item entity
17:04 MTDiscord <W​arr1024> anuke: oh, you mean create a shared cached empty itemstack?  This is only safe of course if you're pretty confident that ItemStacks are immutable...
17:05 anuke[m] shouldnt add_item basically take the arg as const
17:05 MTDiscord <W​arr1024> I do kinda love that you can do local symbol = {} to create abstract symbols in lua, like for table keys and such.
17:05 anuke[m] yes
17:05 anuke[m] malloc(1)
17:06 anuke[m] actually that gives me an idea
17:06 anuke[m] malloc an address, print it, free it
17:06 anuke[m] prng
17:06 MTDiscord <W​arr1024> add_item may not modify the incoming arg, but there's no guarantee that that's the only code that will be run that has access to that stack.
17:06 anuke[m] ok
17:06 MTDiscord <W​arr1024> malloc doesn't make a good prng, because you don't know how the platform reuses or defragments freed memory.
17:07 anuke[m] its /dev/uurandom
17:07 anuke[m] when bad entropy is a commodity
17:07 MTDiscord <W​arr1024> You'll get "arbitrary" results, which may include results that deceptively look like they validate your idea, until they suddenly don't someday.
17:07 anuke[m] yes
17:08 * anuke[m] uploaded an image: Screenshot_17:08:04.png (8KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/TRDMIwXYzIcuebldPkaLiLDi/Screenshot_17:08:04.png >
17:08 anuke[m] very cool terrible rng
17:08 anuke[m] trim first and last 3 hex chars for usable number
17:09 anuke[m] my linux has pages in 672 byte chunks???
17:09 MTDiscord <W​arr1024> Works until somebody decides to use the trick more than once within the same executible instead of having separate process spawns.
17:10 MTDiscord <W​arr1024> Also your prompt is way too fancy and that has gotta break in some pretty interesting ways when you try to ssh in from something with limited termcap support
17:10 MTDiscord <W​arr1024> It's sort of like using PID as an RNG on OpenBSD and then seeing what happens when your program is ported to Linux :-D
17:11 anuke[m] use pid as rng
17:11 anuke[m] then use a forkbomb to increase entropy
17:11 anuke[m] but not really
17:11 anuke[m] i can ssh in on my phone, powerline works
17:11 anuke[m] it only breaks in my ttys
17:12 anuke[m] im 99% sure i have to recompile linux to add the triangle characters
17:15 MTDiscord <W​arr1024> Oh, and calling back to the original subject that started the string concat perf discussion, i.e. that variadic string concat func: I once made a really bizarre library to implement "up in the air arrays", i.e. arrays that are never packed into a table, but stored entirely in Lua's variadics.
17:16 MTDiscord <W​arr1024> You can't actually store a lua list like ... directly into a var without packing it, but you can store a function that returns a variadic list, so I used functions to create passable references to said arrays.
17:16 MTDiscord <W​arr1024> It's surprisingly hard to do normal array things, like seeking to an element, concatenating them, determining their length, etc. without ever packing them into a table.
17:18 anuke[m] lua_pushvalue(L, 1); to get ...[1] but in lua when
17:18 anuke[m] pretty sure select(n, ...) works
17:18 anuke[m] which is basically that but with some if statements
17:19 anuke[m] and a c call
17:19 MTDiscord <W​arr1024> Well, I wasn't doing it in C, I was doing it in pure Lua.
17:19 anuke[m] yes
17:19 anuke[m] select("#", ...) gets lua_gettop(L) - 1;
17:20 anuke[m] why cant you use select
17:20 anuke[m] it exists in luajit
17:20 MTDiscord <W​arr1024> Oh interesting, is select() a builtin?
17:20 anuke[m] yep
17:21 MTDiscord <W​arr1024> neat.  See if you can think of how to implement it in pure lua, though.
17:21 MTDiscord <W​arr1024> I can't be sure that I didn't rely on any "library" functions, but it's definitely more interesting if you have to grow it all from the ground up.
17:22 anuke[m] yeah recursion or packing seem like the only ways
17:22 MTDiscord <W​arr1024> local function select(n, f, ...) if n < 1 then return end if n == 1 then return f end return select(n-1, ...) end
17:23 MTDiscord <W​arr1024> basically variadics act like a linked list sort of in that accessing the head is way easier than accessing the tail
17:24 MTDiscord <W​arr1024> I'm trying to remember how I did reverse and concat but it's a lot less obvious
17:24 MTDiscord <W​arr1024> I seem to recall that I may have actually used reverse to implement concat somehow?
17:29 anuke[m] ooooo lua5.4 has const
17:29 anuke[m] i wonder if it inlines things like `const MODE_1 = 5`
17:30 rubenwardy local MODE_1 <const> = 5
17:30 rubenwardy would be the syntax
17:30 rubenwardy it's dumb
17:31 anuke[m] ah
17:32 anuke[m] its better than c++ [[attribute]] prefix
17:32 anuke[m] like for [[noreturn]]
17:32 anuke[m] -2 characters
17:32 MTDiscord <W​arr1024> ugh dat syntax.  JS's const syntax is much nicer, i.e. the intuitive one.
17:33 MTDiscord <W​arr1024> Sucks that Lua doesn't do const because like 98% of my variables in js are consts, and in Lua I'd probably do at least 85%.
17:34 rubenwardy eh, it's not reall
17:34 rubenwardy attributes make sense, they're annotations
17:35 rubenwardy this shouldn't be an annotation, it should be a fundamental type of variable -   const MODE_1 =5
17:42 anuke[m] and c++-style deconstructors exist too with metamethod __close
17:44 anuke[m] since constants have to be local it would make a lot more sense by replacing local
17:48 adfeno Hi, I installed climate_api regional_weather, pova, and player_monoids in v7 mapgen and can`t move. I can only jump.
17:52 rubenwardy pova and player monoids will conflict
17:52 rubenwardy probably
17:52 rubenwardy I vaguely recall movement issues with climate API as well
17:53 adfeno rubenwardy: Ah, I see.
17:54 adfeno rubenwardy: Thanks, will try removing one or another.
18:02 awell joined #minetest
18:03 leo_rockway joined #minetest
18:09 Hawk777 joined #minetest
18:13 Gustavo6046 I have a banana tree farm (Ethereal's banana trees I think?) arranged in a 3x3 sieve grid, where a dirt block with a banana tree on top is in every intersection of the sieve's lines. (Those lines are more for traversal when chopping the trees.)
18:14 Gustavo6046 Below it is a 2 block tall area where most item drops fall, through the sieve.
18:14 Gustavo6046 Is there a way to push the items together into a small common area? Water unfortunately doesn't seem to push items, which is sad. I wish Minetest Game had more inteeresting mechanics like that. More ways to impart and manipulate very basic automation (like item propulsion and whatnot).
18:15 Gustavo6046 Er, impart as in the propulsion part, but yeah, features that could be employed in very basic automation, like imparting propulsion on items and other things.
18:17 anuke[m] afaik only gravity can move items
18:17 Gustavo6046 :<
18:18 Gustavo6046 maybe there is a mod that pushes items in moving fluid?
18:18 anuke[m] using tech mods seems to be your best bet without rewriting the item entity
18:18 anuke[m] that belongs in vanilla
18:18 Gustavo6046 aw
18:18 Gustavo6046 well, true
18:18 Gustavo6046 it does
18:18 anuke[m] why would a feather be anchored to the ground when in a current
18:18 Gustavo6046 True
18:18 Gustavo6046 Minetest is fun, especially modded
18:18 anuke[m] im pretty sure its in builtin?
18:18 anuke[m] if not check default
18:18 Gustavo6046 But no matter how much content is added
18:18 Gustavo6046 I feel like there are basic things missing, things that could make it so much more fun and replayable
18:19 Gustavo6046 Maybe even make it easier to enjoy for more peopl
18:19 Gustavo6046 anuke[m]: ?
18:19 rubenwardy https://content.minetest.net/packages/TenPlus1/builtin_item/
18:19 anuke[m] the item entity code
18:19 Gustavo6046 Oh, okay
18:19 Gustavo6046 oooh
18:20 anuke[m] epic
18:20 Gustavo6046 yes! epic!
18:20 Gustavo6046 thank you! :D
18:20 Gustavo6046 also
18:20 anuke[m] some of 10+1s stuff belongs in builtin
18:20 anuke[m] like that
18:20 Gustavo6046 do I just set it in world.mt in the server side?
18:20 Gustavo6046 I mean
18:20 Gustavo6046 do I have to download them manually?
18:20 Gustavo6046 Probably not
18:20 Gustavo6046 I've transferred mods manually when I first set up the server
18:21 Gustavo6046 which might have caused issues lol
18:21 anuke[m] just move it into mods and enable it in minetest.conf
18:21 rubenwardy git clone https://notabug.org/TenPlus1/builtin_item
18:21 Gustavo6046 move it into mods?
18:21 Gustavo6046 ohh
18:21 rubenwardy downloading using git is a good idea
18:21 Gustavo6046 yeah, it is
18:21 Gustavo6046 I've done it before
18:21 rubenwardy I personally put all my mods into a git repo
18:21 anuke[m] yeah
18:21 anuke[m] `git pull` to update
18:21 Gustavo6046 i wish there was a way to manage mods from the command line
18:21 rubenwardy and then I put that git repo at    worlds/myworld/worldmods
18:21 anuke[m] see the suggestion
18:21 Gustavo6046 rubenwardy: orrrr
18:21 Gustavo6046 submodules
18:21 Gustavo6046 :o
18:21 rubenwardy yes
18:21 Gustavo6046 I could make the mods folder a single repo
18:21 rubenwardy that's what I meant
18:21 Gustavo6046 yay
18:21 Gustavo6046 \o/
18:21 anuke[m] yes
18:22 anuke[m] good for syncing
18:22 Gustavo6046 yes
18:22 rubenwardy https://gitlab.com/rubenwardy/dev_plays_minetest
18:22 Gustavo6046 good for pulling all at once
18:22 rubenwardy there's a script there too for updating them all
18:22 * Gustavo6046 pulls anuke[m] and rubenwardy a few centimetres closer
18:22 Gustavo6046 :D
18:22 Gustavo6046 Anyway
18:22 Gustavo6046 I have a bunch of mods here
18:23 Gustavo6046 Hmmm
18:24 Gustavo6046 I wonder
18:24 hisforever joined #minetest
18:25 Gustavo6046 I have no idea how I'll convert them into Git submodules without deleting-readding them one by one.
18:27 hisforever Dose anybody know how to set up advtrains atc and singles? I'm going in circles lol
18:31 Gustavo6046 hisforever: circles are pretty!
18:31 Gustavo6046 My bad, couldn't resist :p
18:34 hisforever lo; Guestaco8046
18:34 hisforever understand
18:36 Gustavo6046 rubenwardy: I think I know what I'll do, I might use ?q=... to get only mods that match the name/id of the original mod folder, and scrape for the git address
18:36 Gustavo6046 actually I'll scrape the results links, crawl them one by one until I find the one that has an exactly matching mod ID/name
18:37 Gustavo6046 If multiple are found, might ask about them after the rest is done
18:37 Gustavo6046 Is this fine by you?
18:37 Gustavo6046 then I can output a list of mod IDs and their respective git links
18:59 numzero_ joined #minetest
19:17 garywhite joined #minetest
19:27 rubenwardy sure
19:27 rubenwardy ContentDB has an open API, Gustavo6046
19:27 rubenwardy I have ratelimiting in place
19:28 indiana joined #minetest
19:28 bebebeka joined #minetest
19:29 rubenwardy as in, it's kept open and I do have protections if it is hit so much. You won't get told off for using it
19:29 rubenwardy https://content.minetest.net/help/api/
19:29 numzero joined #minetest
19:32 Gustavo6046 rubenwardy: oh, okay
19:33 Gustavo6046 I... dunno why I didn't think about asking about an API first, lol.
19:33 Gustavo6046 But thanks!
19:42 AndDT joined #minetest
19:43 olliy joined #minetest
19:45 adfeno How to use set_nametag to change players nametag?
19:46 adfeno I'm trying to make a func for register_chatcommand to do this, but doesn't work
19:46 adfeno MWE:
19:47 adfeno minetest.register_chatcommand("test", { privs = { server = true }, func = function(playername) minetest.get_player_by_name(playername):set_nametag_attributes({color = {r = 255, g = 255, b = 0}, text = "Tested" }) end })
19:52 adfeno Also, does it also work with Chat name ?
19:59 mazes_83 joined #minetest
20:09 adfeno OK, only works for players overhead, not for chat.
20:11 absurb joined #minetest
20:45 alex-resist joined #minetest
21:07 TechDude joined #minetest
21:18 Sven_vB is there a chat command in MT to list all nicknames of users currently online on the server?
21:19 sfan5 /status
21:22 majochup joined #minetest
21:53 Fixer_ joined #minetest
22:01 Sven_vB thanks!
22:15 leo_rockway joined #minetest
22:43 Wuzzy fun fact: on JT2 it's not "/status", but "/ls"
22:43 Wuzzy because players are actually just files, hence the "ls" command. makes perfect sense. 😉
22:49 Gustavo6046 The repo link here is broken. https://content.minetest.net/packages/Mineminer/technic_addons/
22:52 rubenwardy removed
22:52 rubenwardy I don't know where it is now
22:52 rubenwardy but they've deleted their account
22:52 Gustavo6046 oh, ok
22:52 Gustavo6046 alrighty
22:53 Gustavo6046 I.... don't know how to feel about it. I guess thanks for cleaning the contentdb anyway!
22:53 Gustavo6046 I mean about the situation as a whole lol
22:53 rubenwardy I plan to make a CLI in the future
22:53 Gustavo6046 ooh
22:53 rubenwardy there is actually already one
22:53 Gustavo6046 rubenwardy: well I was working on some Python code
22:54 Gustavo6046 It's not really finished, but you might be interested in looking at it.
22:54 Gustavo6046 It doesn't have a lot either, but it does have some definitions for ContentDB packages, and some utilitie sfor fetching them online
22:54 Gustavo6046 The package definition is a little incomplete I think, whereas the search result item definition isn't.
22:57 rubenwardy was thinking of this: https://forum.minetest.net/viewtopic.php?t=24914
22:57 sfan5 !title
22:57 MinetestBot sfan5: [CONTENTDB] ContentDB cli, beta release - Minetest Forums
22:58 rubenwardy the forums are soooooo slow
22:58 rubenwardy https://gitlab.com/Niwla2305/contentdb-cli
22:58 Gustavo6046 ah
22:58 rubenwardy not tried it
22:58 Gustavo6046 rubenwardy: sent you an invite on github, so you can change things too :D
22:58 Gustavo6046 I mean contributor invite
22:58 Gustavo6046 But either way
22:59 Gustavo6046 https://github.com/Gustavo6046/minetest_packages
22:59 Gustavo6046 Just wanted to put this out on gituhb
22:59 Gustavo6046 Let me just
22:59 Gustavo6046 license it real quick
22:59 rubenwardy also, I think a CLI aimed at services should also use Git mostly to download things
22:59 rubenwardy *servers
22:59 Gustavo6046 Ah
22:59 Gustavo6046 What I did just looks at metadata
22:59 rubenwardy rather than the zip download method the MT client uses
22:59 Gustavo6046 rubenwardy: contentdb should support Git
22:59 rubenwardy it does
22:59 Gustavo6046 oh
23:00 Gustavo6046 you mean
23:00 Gustavo6046 it provides git as well as zip?
23:00 rubenwardy there's git repo information, and it links releases to commits
23:00 Gustavo6046 yes but
23:00 Gustavo6046 what if a mod doesn't have an associated git repo?
23:00 rubenwardy then you have to use zip downloads
23:00 Gustavo6046 either way ContentDB should be able to provide its own mirror
23:00 Gustavo6046 or even host its own bare repository if there is no existing repo to mirror
23:00 Gustavo6046 do you think you can/should do that?
23:02 Gustavo6046 rubenwardy: I added a readme and licensed it under MIT
23:14 Gustavo6046 rubenwardy: so, in an uselessness scale from 0 (way too useful) to 10 (delightfully useless), how highly do you rate it? :P lol
23:14 Gustavo6046 also, sorry if I'm bothering you too much lol
23:16 Gustavo6046 Anyways
23:16 Gustavo6046 I'm having an error trying to start the server now - 'beds' ( https://content.minetest.net/packages/sorcerykid/beds/ ) complains about not being able to load player spawn data. https://termbin.com/tz3z
23:17 Gustavo6046 I guess I'll just not load it
23:17 Gustavo6046 I wonder if beds will work now after fixing up little issues in the mods list, but probably not.
23:17 Gustavo6046 Btw minetest_game is from master, but Minetest is 5.3.0.
23:17 Gustavo6046 I realized that was probably what anuke[m] meant
23:18 Gustavo6046 The other day
23:18 Gustavo6046 Running the server still produces a bunch of warnings lol, but they don't seem to mean anything. I think they already were there, plus I finally fixed the dependency resolution issues that seemed to benignly plague the server before. (Again, not fatal, but not nice either)
23:23 MTDiscord <J​onathon> you really should checkout version 5.3.0 to go with your minetest version of 5.3.0
23:25 Gustavo6046 Oh, ok
23:26 Gustavo6046 Hm, why is this not in the contentdb? https://forum.minetest.net/viewtopic.php?f=9&amp;t=18429
23:26 Gustavo6046 Also thanks @Jonathon !
23:27 Gustavo6046 VanessaE: also what cx384 said about pipeworks' API and being unable to take items out of a Storage Interface, is it true? Or at least, is it true *now*?
23:27 Gustavo6046 Check the ofrum post
23:27 Gustavo6046 the "Pipeworks note" under the download/github links
23:27 Gustavo6046 s/ofrum/forum
23:30 VanessaE I have no idea, Gustavo6046. ask nore  :)
23:31 delta23 joined #minetest
23:32 erlehmann joined #minetest
23:32 Gustavo6046 Hmmm.
23:35 Gustavo6046 Gosh, esc key making it exit.... why not at least a confirmation modal?
23:35 rubenwardy making what exit?
23:36 rubenwardy if you mean the error dialog, that's a bug which has been fixed in 5.4 (releasing soon)
23:38 Gustavo6046 rubenwardy: no, I mean esc makes the game exit, but it doesn't even ask
23:38 rubenwardy it shouldn't
23:38 Gustavo6046 I hit Esc to exit modals like the "Invalid pasword" one, when I mistype the password
23:38 Gustavo6046 Ah
23:39 rubenwardy that's the error dialog
23:39 Gustavo6046 oh I see
23:39 Gustavo6046 ah I see!
23:39 rubenwardy the error dialog shows lua errors and "access denied" errors
23:39 Gustavo6046 thanks
23:39 rubenwardy so yeah, that'll be fixed
23:39 Gustavo6046 Ahh okay
23:39 Gustavo6046 thanks!
23:40 Gustavo6046 hmm, I wonder which of those mods I installed added this uwnanted (read: pesky and annoying) behaviour of torches dealing damage.

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