code logs -> 2016 -> Sun, 20 Nov 2016< code.20161119.log - code.20161121.log >
--- Log opened Sun Nov 20 00:00:16 2016
00:26 grindhold [quassel@Nightstar-0ona3l.cyan.servdiscount-customer.com] has quit [Operation timed out]
00:40
<@Alek>
something about 80-volt cordless drill and 22-caliber cartridges in a belt feed making for 420 rounds a minute, I think.
00:45 grindhold [quassel@Nightstar-0ona3l.cyan.servdiscount-customer.com] has joined #code
00:45 mode/#code [+o grindhold] by ChanServ
00:50 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [Connection closed]
00:56
<@celticminstrel>
"git fidd" huh.
00:56
<@celticminstrel>
No, I did not mean "add".
01:27
<@celticminstrel>
Trying to figure out how I can show a file-chooser in JS and determine whether the user clicked cancel.
01:27
<@celticminstrel>
First part is easy. Second part is hard, unless there's some other way to show the chooser than input.click(), because the latter returns immediately.
01:30
<@celticminstrel>
Hm hm. I guess the change event would do what I want; since it's a newly constructed element, it'll start empty, so if they choose something it'll change and if the don't it won't.
01:50
<@celticminstrel>
I hope localStorage.getItem() doesn't throw security exceptions...
02:23
<&[R]>
https://www.html5rocks.com/en/tutorials/file/dndfiles/ <-- that help you any?
02:24
<@celticminstrel>
That was actually the first link I found, I think. And it did help, yes.
02:24
<@celticminstrel>
That was the first part.
02:24
<@celticminstrel>
Anyway, I've solved the problem now.
02:25 VirusJTG_ [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
02:26
<@celticminstrel>
https://github.com/CelticMinstrel/malandread/commit/a70ad37
02:27
<@celticminstrel>
I guess the relevant code is way at the bottom.
02:28 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Ping timeout: 121 seconds]
02:38 catadroid [catalyst@Nightstar-tp6lfu.dab.02.net] has joined #code
02:48 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
02:48 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:09
<&Derakon>
Gotta say, it does annoy me how little Lua has in terms of useful data structures.
04:09
<&Derakon>
Sure, you can do anything with tables, but that doesn't make it pleasant to use them.
04:09
<&Derakon>
And I'd really rather not have to implement e.g. my own queue datastructure.
04:10
<@celticminstrel>
Tables can be used as a queue without anything extra, can't they?
04:10
<&Derakon>
"Although we can implement queues trivially using insert and remove (from the table library), this implementation can be too slow for large structures."
04:10
<@celticminstrel>
Using the functions in the "table" table.
04:10
<&Derakon>
From https://www.lua.org/pil/11.4.html
04:10
<@celticminstrel>
Okay fine.
04:10
<&Derakon>
More generally, one-based indexing is a sign of brain damage. >.<
04:10
<&Derakon>
It pisses me off every time I encounter it.
04:10
<&Derakon>
(Pretty sure I harped on this earlier, but it still bugs me)
04:13
<@celticminstrel>
It's not a sign of brain damage.
04:14
<&[R]>
It's a sign that the language is expected to be used by those with brain damage, due to the fact it causes brain damage from being used.
04:14
<@celticminstrel>
No, it's not.
04:15
<&[R]>
Can you name a sane language that uses 1-based indexing?
04:18
<@celticminstrel>
Lua seems sane enough to me?
04:18
<@macdjord>
Derakon: In anything except very low-level work, 1-indexing is more natural and better than 0-indexing. Unfortunately, it has such cultural inertia now that using 1-dixing simply isn't worth it.
04:18
<@celticminstrel>
I feel like there might be something Lisp-like too (Logo?), not sure. Also some Pascal-based things (Turing?).
04:19
<@celticminstrel>
Anyway, what macdjord said.
04:19
<&Derakon>
I will note that 1-indexing is particularly broken for "I want to select a random item from this list" and "I want to loop from the end of the list to the start". You have to throw in +1s that aren't otherwise needed.
04:20
<@celticminstrel>
That doesn't make it broken.
04:20
<&Derakon>
I didn't say it was broken, I just said it was damaged.
04:20
<@celticminstrel>
Also, by that argument, 0-based indexing is broken for "I want to loop from the beginning of the list to the end", because you have to throw in -1s that aren't otherwise needed.
04:20
<&Derakon>
It still gets the job done, just worse than it could have.
04:20
<@celticminstrel>
You used the word "broken", so.
04:20
<&Derakon>
for i = 0; i < len(list); ++i
04:20
<&ToxicFrog>
macdjord, celticminstrel: low-level work? 0-indexing is way more convenient for coordinates and for wrapping around an array with %, both things I do a lot.
04:20
<&Derakon>
There's no offset there.
04:21
<@macdjord>
Derakon: No it doesn't. for (i = 1; i <= len; i++)
04:21
<&Derakon>
Mac: that's fine, wrapping around isn't.
04:21
<&ToxicFrog>
I like Lua but I'm pretty comfortable calling 1-indexing a wart, especially considering that it's meant to interface heavily with C, which is...0-indexed.
04:21
<&Derakon>
In 0-indexing you can do "i = i % len(list)"
04:21
<&[R]>
I like the interaction with C point earlier. Where you have to make needless conversions on the indexes.
04:21
<@macdjord>
ToxicFrog: Okay, wrapping I'll grant you.
04:22
<~Vornicus>
also dimension changes, also random selection
04:22
<@celticminstrel>
How is random selection even relevant?
04:22 * celticminstrel has no idea what you mean by dimension changes.
04:22
<&Derakon>
I'm writing a game?
04:22
<&Derakon>
I want my AI to pick one of their valid actions at random.
04:22
<@celticminstrel>
No, I mean, how does 0 vs 1 indexing have any impact on it.
04:22
<@macdjord>
Derakon: randint(1, len)
04:22
<&ToxicFrog>
Derakon: actions[math.random(1, #actions)] ?
04:22
<@celticminstrel>
Assuming closed range, yes.
04:23
<@macdjord>
As opposed to randint(0,len-1)
04:23
<&Derakon>
...okay, you're right, I already have that written. >.>
04:23
<~Vornicus>
celmin: pile[random() * len(pile)]
04:23
<@celticminstrel>
(Picking a skill at random is pretty terrible though.)
04:23
<@macdjord>
Vornicus: So Don't Do That Then~
04:23
<&Derakon>
CM: you'd be amazed at how awesome games are made from shitty AIs.
04:23
<&ToxicFrog>
Vornicus: that assumes all you have is a random() that returns something in the range [0.0, 1.0)
04:24
<&ToxicFrog>
Which isn't usually the case and definitely isn't the case in lua specifically.
04:24
<@celticminstrel>
Derakon: Sure, but when monsters keep healing uninjured allies (or self) or try to summon when there's no free space, that's pretty terrible.
04:24
<&Derakon>
Note I said valid actions~
04:24
<@celticminstrel>
Well, okay.
04:24
<@macdjord>
celticminstrel: Irrelevent; it was a random example of why you might want to pick a random element from a list.
04:25
<@celticminstrel>
?
04:25
<&Derakon>
Eh, if he wants to go on a tangent, I think we've milked the 1-indexing argument for all it's good for.
04:25
<&Derakon>
So by all means, argue about game AIs now.
04:25 * celticminstrel knew it was a tangent and not directly relevant to the 1-indexing thing.
04:25
<@celticminstrel>
That's why it was initially parenthesized.
04:25
<&ToxicFrog>
Derakon: as far as data structures go, I'm pretty sure this is part of the "keep the core minimal" philosphy; there's an assload of utility libraries that add various structures with various tradeoffs, if you don't feel like writing your own from scratch.
04:26
<&ToxicFrog>
(maps, sets, and vectors you get essentially for free and 90% of the time that's all I need, so)
04:26
<&Derakon>
TF: got a recommended place to look for them?
04:26
<&Derakon>
Like, is there a registry or repository or something?
04:28
<~Vornicus>
dimension change: consider a thing which is indexed two ways: one 1-dimensional, one 2-dimensional. if the indexes are 0-based, then k = y*w + x, y = k // w, x = k % w. 1-based means you have k = (y - 1)*w + x, y = (k - 1) // w + 1, x = (k - 1) % w + 1
04:30
<@celticminstrel>
So clearly Pascal is best, right?
04:35
<&ToxicFrog>
Derakon: http://lua-users.org/wiki/LibrariesAndBindings is a community-maintained directory
04:35
<&ToxicFrog>
Derakon: and https://luarocks.org/ is the lua CPAN-alike
04:36
<&Derakon>
Good to know, thanks!
04:46
<&Derakon>
It does kind of bug me that I can't find license info prominently displayed on luarocks.
04:47
<&Derakon>
...nemmind, I'm blind.
04:53 * Derakon glares at his brain.
04:54
<&Derakon>
I can't tell what dumb error I'm making.
04:54
<&Derakon>
function Battleground:pathfind(start, end)
04:54
<&Derakon>
...oh, it's that I named a variable "end", isn't it?
04:54
<&Derakon>
Yep.
04:54
<&Derakon>
Thank you for being my rubber ducky, #code.
05:00
<&[R]>
I'm guessing that's because Lua decided words are better tokens?
05:01
<&ToxicFrog>
[R]: end is a reserved word in lua, yes
05:01
<&[R]>
That much I gathered
05:02 * celticminstrel curious what you'd call it instead.
05:03
<&Derakon>
I assume [R] meant "as opposed to using } or ) or some other symbol".
05:03
<&[R]>
^
05:03
<&Derakon>
And yeah, Lua's pretty sparing with the glyphs.
05:04
<&Derakon>
I appreciate that kind of thing. Words are easier to read.
05:04
<@celticminstrel>
No, I mean since it's a reserved word, what name would you use for the variable.
05:04
<&Derakon>
Oh.
05:04
<&Derakon>
end_cell.
05:04
<@celticminstrel>
I see.
05:04
<&Derakon>
If I weren't in a grid-based map I'd use end_pos or something similar.
05:04
<@celticminstrel>
There's no good synonym for end though... best I can think of is "final".
05:04
<&ToxicFrog>
I generally use start/finish or first/last or the like
05:04
<&[R]>
"done" but Lua reserves that too doesn't it?
05:04
<&ToxicFrog>
For grid stuff it's (x,y,w,h)
05:04
<@celticminstrel>
Oh, finish, sure.
05:05
<@celticminstrel>
Pretty sure Lua does not reserve done.
05:05
<&ToxicFrog>
[R]: no.
05:05
<&[R]>
Last is a good one though
05:05
<@celticminstrel>
Last doesn't go well with start though.
05:06
<&ToxicFrog>
Behold, all the reserved words in lua: https://www.lua.org/manual/5.2/manual.html#3.1
05:06
<&ToxicFrog>
Fewer than in C.
05:07
<&[R]>
If I were forced to deal with a language that used full word tokens for block markers, and the person responsible for chosing that language were dealing with my code, I'd go full spite mode and use carret/dollar.
05:07
<&Derakon>
Heh.
05:07 Derakon is now known as Derakon[AFK]
05:07
<&Derakon[AFK]>
Time for bed. Night.
05:07
<@celticminstrel>
I don't get it?
05:07
<&[R]>
Regexes
05:08
<@celticminstrel>
Well, yeah, I see it's referencing that, but...
05:08
<@celticminstrel>
Oh, wait, you're saying you'd name the variables "caret" and "dollar"?
05:08
<&[R]>
Yeah
05:08
<@celticminstrel>
Ah, heh
05:08
<&[R]>
Or car/dol
05:10
<@celticminstrel>
That'd probably confuse anyone.
05:10
<~Vornicus>
in python if you find yourself needing a name that's the same as a reserved word, convention is to append _ to it. Making a D&D character? It's got a class_
05:11 * celticminstrel would probably call it something like charClass (or char_class, depending which convention I happen to be feeling like using).
05:11
<&ToxicFrog>
job
05:25 catadroid` [catalyst@Nightstar-jhqmds.dab.02.net] has joined #code
05:29 catadroid [catalyst@Nightstar-tp6lfu.dab.02.net] has quit [Ping timeout: 121 seconds]
07:25 macdjord is now known as macdjord|slep
07:43 celticminstrel [celticminst@Nightstar-h4m24u.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
09:48 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
10:37 catadroid` is now known as catadroid
10:43 Kindamoody is now known as Kindamoody|out
11:55 catadroid` [catalyst@Nightstar-q99.klt.132.82.IP] has joined #code
11:58 catadroid [catalyst@Nightstar-jhqmds.dab.02.net] has quit [Ping timeout: 121 seconds]
11:58 catadroid` is now known as catadroid
12:03 ion_ [Owner@Nightstar-6grqph.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
12:05 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
12:05 mode/#code [+o ion] by ChanServ
12:22 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
12:24 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
12:24 mode/#code [+o ion] by ChanServ
12:28 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
12:28 VirusJTG_ [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Leaving]
12:28 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
12:28 mode/#code [+ao VirusJTG VirusJTG] by ChanServ
13:03 ion_ [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
13:03 mode/#code [+o ion_] by ChanServ
13:04 catalyst` [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
13:04 macdjord [macdjord@Nightstar-cd2k4t.mc.videotron.ca] has joined #code
13:04 mode/#code [+o macdjord] by ChanServ
13:04 Netsplit Deepthought.Nightstar.Net <-> Kakrafoon.Nightstar.Net quits: @simon_, @Ogredude, @macdjord|slep, @Tamber, @ion, catalyst, @Logar, @VirusJTG, @jerith
13:05 catalyst` is now known as catalyst
13:07 jerith [jerith@Nightstar-dmm.807.239.23.IP] has joined #code
13:07 mode/#code [+ao jerith jerith] by ChanServ
13:08 mode/#code [+o Ogredude] by ChanServ
13:08 Netsplit over, joins: Ogredude
13:08 mode/#code [+o Logar] by ChanServ
13:08 Netsplit over, joins: Logar
13:08 Netsplit over, joins: simon_
13:08 mode/#code [+o simon_] by ChanServ
13:09 Tamber [tamber@furryhelix.co.uk] has joined #code
13:09 mode/#code [+o Tamber] by ChanServ
13:30 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
13:31 Magique [bja9@Nightstar-vt4.l73.164.160.IP] has joined #code
13:32 Magique [bja9@Nightstar-vt4.l73.164.160.IP] has quit [[NS] Quit: ]
13:44
<@gnolam>
http://seiferteric.com/?p=356
13:44
<@gnolam>
https://techcrunch.com/2016/11/18/this-security-camera-was-infected-by-malware-i n-98-seconds-after-it-was-plugged-in/
13:59 * TheWatcher eyes that QR code thing
13:59
<@TheWatcher>
.... why?!
14:32
<@gnolam>
Same reason you'd do IP over Avian Carriers, or TCP/IP over bongo drums.
14:40
<@TheWatcher>
Because you have too much time on your hands? >.>
14:43
<&ToxicFrog>
````
16:50 Derakon[AFK] is now known as Derakon
17:54 celticminstrel [celticminst@Nightstar-h4m24u.dsl.bell.ca] has joined #code
17:54 mode/#code [+o celticminstrel] by ChanServ
18:01 catadroid [catalyst@Nightstar-q99.klt.132.82.IP] has quit [Ping timeout: 121 seconds]
19:25 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [Connection reset by peer]
19:28 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
19:52 * celticminstrel is looking at the regex engine I wrote for fun awhile ago.
20:04 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
20:04 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:11 Kindamoody|out is now known as Kindamoody
20:31 Kindamoody [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has quit [Connection closed]
20:38 Kindamoody [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has joined #code
20:38 mode/#code [+o Kindamoody] by ChanServ
21:02
<@celticminstrel>
Suddenly my key handlers are mysteriously not working...
21:02
<@Logar>
celticminstrel: Fire them and hire new ones, with less taste for drink and more taste for working hard handling your keys!
21:03
<@celticminstrel>
Ha ha
21:14
<@celticminstrel>
Why is Object.watch not working...
21:15
<@celticminstrel>
Oh, I see.
21:17
<@celticminstrel>
So basically I had a corrupt save state that for some reason claims the gamestate is in "popup" mode rather than "playing" mode, I think...
21:45 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving]
22:06
<@celticminstrel>
Blargh, how do I remove an event listener set with $().eventname()...
22:07
<@Logar>
Keep a reference somehow?
22:07 catadroid [catalyst@Nightstar-v4r59k.dab.02.net] has joined #code
22:07 catadroid [catalyst@Nightstar-v4r59k.dab.02.net] has quit [The TLS connection was non-properly terminated.]
22:10
<@celticminstrel>
Wait, did .off() actually do what I want after all?
22:11
<@celticminstrel>
Looks like I misunderstood the documentation.
22:11
<@celticminstrel>
Or forgot that .keydown(...) was the same as .on("keydown",...).
22:12
<&[R]>
Were you only wanting the event to fire once?
22:12
<@celticminstrel>
No.
22:12
<&[R]>
If so there's a one-time hook IIRC
22:12
<&[R]>
Otherwise I'm not even certain of the usecase for removing a handler
22:12
<@celticminstrel>
The handler is installed when the game begins. I added a way to get back to the menu, so I wanted to remove the handler when that happens.
22:13
<@celticminstrel>
Previously reloading the page was the only way to get back to the menu.
22:14
<@celticminstrel>
Which is fine for testing (you want it reloaded anyway to refresh stuff), but when playing it's kinda silly.
22:17 catadroid [catalyst@Nightstar-v4r59k.dab.02.net] has joined #code
22:43 catadroid [catalyst@Nightstar-v4r59k.dab.02.net] has quit [[NS] Quit: Bye]
23:05 KiMo|autorejoin [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has joined #code
23:05 mode/#code [+o KiMo|autorejoin] by ChanServ
23:07 Kindamoody [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
--- Log closed Mon Nov 21 00:00:32 2016
code logs -> 2016 -> Sun, 20 Nov 2016< code.20161119.log - code.20161121.log >

[ Latest log file ]