#join function not working correctly

47 messages · Page 1 of 1 (latest)

wise mauve
hushed karmaBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

kind oakBOT
#

Paste version of plank_recipes.js, server.log from @wise mauve

oak sonnet
#

what should it do?

wise mauve
#

join with an underscore

#

rather than a comma

#

because I have specified underscore in the join function

oak sonnet
#

oh hmmm

frail dove
#

1.19 so i dont think this will be fixed any time soon

#

cuz rhino is mostly abandoned now

oak sonnet
#

so you might just have to make a function which does that yourself

#

or override the current one

wise mauve
#

well that's annoying, luckily making it myself isn't overly difficult

#

loop through elements in the array and just concatenate them, if it isn't the last element also add an underscore

wise mauve
#

or I could cheat since I know I only ever have 1 or 2 elements and could just check if I had 2 elements wedge an underscore in

#

I'm probably going to do that because shoddy design that I'm going to kick myself over for the win

#

should this be tagged as a mod bug?

#

okay this gets weirder

#

just custom wrote behaviour

#

same issue

#

??

kind oakBOT
#

Paste version of plank_recipes.js, server.log from @wise mauve

oak sonnet
#
Array.prototype.join = i => {
    i = i ?? ','
    let result = ''
    for (let j = 0; j < this.length; j++) if(j!=this.length-1) result+=`${this[j]}${i}`
    return result
}
#

not tested

wise mauve
#

how is it still using comams

#

*commas

oak sonnet
#

did you save the file? heh

wise mauve
#

yup...

#

also I've fixed my indenting issue but js isn't indent sensitive so that doesn't fix it...

#

wtf is happening

#

what is wrong with it???

#

how is it managing to not interpret plank[0] + "_" + plank[1]

#

and adding a comma instead

#

I do not understand

#

how

#

@oak sonnet Nevermind I figured out the issue, the whole reason the join function wasn't working, all of it, boiled down to me forgetting to set the output to plank

#

so it never actually got set

#

so it stayed as a list...

#

the join function does work

#

Wow I knew I was tired but didn't think I was this tired

#

and to think we all missed it...

wise mauve
#

Thanks for cooperating with my stupidity xD