code logs -> 2007 -> Wed, 30 May 2007< code.20070529.log - code.20070531.log >
--- Log opened Wed May 30 00:00:31 2007
00:11 ToxicFrog|W`rkn is now known as ToxicFrog
00:12 Derakon[AFK] is now known as Derakon
00:30 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has quit [Client exited]
01:40 ReivZzz is now known as Reiver
02:04 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has joined #code
02:19
<@Derakon>
TF, whenever you poke your head in here - where would you recommend I start WRT persisting data? E.g. I want to save the results of my map editor.
02:28
<@ToxicFrog>
If they're Lua tables, saving is a simple recursive table walk with reference resolution and loading is a loadfile() call.
02:29
<@Derakon>
Fortunately, the map *is* a table.
02:30
<@Derakon>
So is there something like "createFileThatCompletelyDefinesThisTable(table)"?
02:30
<@ToxicFrog>
Not in the stdlib, but I have at least two kicking around and it's pretty easy to write.
02:30
<@Derakon>
Heh. Fair enough.
02:30
<@Derakon>
Yeah...you'd just iterate over all fields in the table, checking types, and recursing if the field is itself a table.
02:31
<@Derakon>
Mmm, metacode.
02:31
<@ToxicFrog>
If you don't need to worry about reference resolution (where you have multiple keys that point to the same value) it's just a recursive walk with pairs()
02:31
<@Derakon>
Well, the map maps positions to references to objects, but each referred-to object shows up at most once in the map.
02:31
<@ToxicFrog>
Also, the %q flag to string.format is your god.
02:32
<@Derakon>
%q?
02:32
<@ToxicFrog>
It is "%s, but in a format that can be unambiguously read back by the interpreter"
02:32
<@ToxicFrog>
So it properly escapes everything and so forth.
02:32
<@Derakon>
Ahh, very nice.
02:32
<@ToxicFrog>
So your typical format for individual table entries (which are strings) is "[%q] = %q;", key, value
02:33
<@Derakon>
Lemme mash up a quick pseudocode on pastie...
02:33
<@ToxicFrog>
Aha, here's what I was looking for.
02:34
<@ToxicFrog>
Do you have my util.lua?
02:34
<@Derakon>
Don't think so.
02:34
<@ToxicFrog>
If so, ttoa() is what you need.
02:34
<@ToxicFrog>
Ok.
02:34
<@Derakon>
Table-to-alpha?
02:34
<@ToxicFrog>
table-to-ascii
02:34
<@Derakon>
Righto.
02:34
<@ToxicFrog>
from atoi/itoa, etc.
02:34
<@ToxicFrog>
Catch.
02:34
<@Derakon>
Right.
02:34
<@ToxicFrog>
Note: this file is a work in progress. Do not use as is.
02:35
<@Derakon>
Got it.
02:35
<@ToxicFrog>
However, ttoa() will do what you need.
02:35
<@Derakon>
Danke schoen.
02:35 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Quit: Z?]
02:35
<@ToxicFrog>
Specifically, it generates a (not terribly readable, but fully reference-resolved) string which, when loaded as a function and called, returns a copy of the saved table.
02:35
<@ToxicFrog>
It seralizes functions, too.
02:35
<@ToxicFrog>
Do not use on C functions or closures.
02:36 * Derakon snerks.
02:36
<@ToxicFrog>
Studying ttoa, tprint and tclone should give you all the tools you need to write your own, too.
02:37
<@ToxicFrog>
ttoa looks kind of nasty because it doesn't nest all the tables in one go, instead it goes:
02:37
<@ToxicFrog>
table_1 = { ... }
02:37
<@ToxicFrog>
table_2 = { ...stuff that references table_1... }
02:38
<@Derakon>
I think I could probably write one that does what I need already, since I don't require especially smart serialization.
02:38
<@ToxicFrog>
table_final = { ...stuff that references previous tables... }
02:38
<@Derakon>
Most of the map is pretty stateless stuff.
02:38
<@ToxicFrog>
return table_final
02:38
<@ToxicFrog>
Thus ensuring that if you do something like this:
02:38
<@ToxicFrog>
t = {}
02:38
<@ToxicFrog>
t.a = {}
02:38
<@ToxicFrog>
t.b = t.a
02:38
<@ToxicFrog>
(thus, t.a == t.b)
02:38
<@ToxicFrog>
u = loadstring(ttoa(t))()
02:38
<@ToxicFrog>
u.a still == u.b.
02:39
<@Derakon>
Nice.
02:39
<@Derakon>
Your tabsize is absurd, man. ¬.¬
02:40
<@ToxicFrog>
er?
02:40
<@Derakon>
Eight-space indentations.
02:40
<@ToxicFrog>
...wtf
02:40
<@Derakon>
:%s/ / /g is my friend, though.
02:40
<@ToxicFrog>
Ok, this means something is doing tab/space conversion behind my back.
02:40
<@Derakon>
Maybe it happened in the file transfer.
02:40 * Derakon shrugs.
02:40
<@ToxicFrog>
Because when I wrote it, it was tab characters, with tabs set at four spaces.
02:41
<@ToxicFrog>
Hmm. Yeah, it's still tabs when I open it locally.
02:41
<@Derakon>
I could swear I set my .vimrc to convert tabs to four spaces.
02:42
<@Derakon>
Yeah. set tabstop=4.
02:43
<@Derakon>
Hrm. My Lua doesn't like sprintf. Odd.
02:43
<@Derakon>
I'm using 5.1. What're you using?
02:44
<@ToxicFrog>
I don't use vi.
02:44
<@Derakon>
...oh, you rolled your own. Heh.
02:44
<@ToxicFrog>
5.1.2, but note that I define sprintf earlier in that file.
02:44
<@ToxicFrog>
function sprintf(...) return string.format(...) end
02:44
<@ToxicFrog>
Err,
02:44
<@ToxicFrog>
function sprintf(fout, ...) return fout:write(string.format(...)) end
02:44
<@Derakon>
No, you got it right the first time.
02:44
<@ToxicFrog>
Gnar
02:45
<@Derakon>
You just gave me fprintf.
02:45
<@ToxicFrog>
It's too late for my brain
02:45
<@ToxicFrog>
Which is of course why I'm writing a SupComm mod~
02:45
<@Derakon>
Heh.
02:47
<@ToxicFrog>
(I actually want to be playing Odin Sphere, but Oculus is still recompiling itself)
02:47
<@Derakon>
I also want to be playing Odin Sphere, but Amazon preorders evidently ignore the presence of Amazon Prime, and thus used 5-day shipping instead of 2-day shipping.
02:48
<@ToxicFrog>
Aah.
02:48 * ToxicFrog just walked down to his local Microplay and requested a copy.
02:48
<@Derakon>
See, I *should* have done that.
02:49
<@Derakon>
But by the time I thought of it, Odin Sphere had already shipped, thereby making cancelling my Amazon order neatly impossible.
02:53 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
02:58 * Derakon twitches gently at Lua and Google. "How in the blazing hells do I open a file for writing?"
02:58
<@Derakon>
I've been searching for, like, ten minutes now.
02:58
<@ToxicFrog>
...why are you using google?
02:59
<@ToxicFrog>
fout = io.open(filename, "wb")
02:59
<@Derakon>
To search the Lua site.
02:59
<@ToxicFrog>
http://www.lua.org/manual/5.1/manual.html#5.7
02:59
<@Derakon>
Yes, I just found that myself. >.<
03:00
<@Derakon>
Okay, there we go.
03:00 * Derakon reads his manually-created map, saves it to a file, and reloads it.
03:00
<@Derakon>
Thanks for the help, TF.
03:01
<@Derakon>
Oh, and idly - there's a new LoZ TAS.
03:03
< Takyoji>
TAS?
03:03
<@Derakon>
Tool-assisted speedrun (of a console game).
03:03
< Takyoji>
Ahh
03:03
<@Derakon>
Basically uses emulators and lots and lots of savestating to get a "perfect" run through the game.
03:04
< Takyoji>
Ahh, like a keystate recorder or something?
03:04
<@ToxicFrog>
Yes, I saw it.
03:04
<@ToxicFrog>
The LoZ runs don't really do it for me.
03:04
<@ToxicFrog>
Takyoji: yes. The recording is of button states.
03:04
< Takyoji>
ahh
03:04
<@Derakon>
I like when they enter a room full of blue Darknuts and kill them all in two seconds.
03:04
<@ToxicFrog>
You can thus play it back on any emulator+ROM and verify that it is legit.
03:05
< Takyoji>
ahh
03:05
<@ToxicFrog>
TASVideos also releases AVI versions, for convenience.
03:05
<@ToxicFrog>
Derakon: see, I've never played the original LoZ.
03:05 Serah [~Z@87.72.36.ns-26407] has quit [Quit: Don't try to read the quit message, that is impossible. Instead only realize the truth; "there is no quit message" and you will see it is not you who read the quit message but the quit message who reads you.]
03:05
<@ToxicFrog>
So I have no idea if that's impressive, or business as usual.
03:05
< Takyoji>
Bah, who needs 'em, I just use the Gameshark code..
03:05
< Takyoji>
codes*
03:05
<@Derakon>
'Ey, Bob.
03:05
<@ToxicFrog>
...the whole point of this, Takyoji, is that they don't cheat.
03:05
< Takyoji>
Ahh
03:06
<@Derakon>
Well, beyond the massive savestates.
03:06
<@ToxicFrog>
And the slow motion and the frame advance and the input editing and the memory analysis, yes.
03:06
<@Derakon>
In theory, a human with frame-perfect timing could do the same thing on an actual console, albeit one with a broken controller.
03:06
<@ToxicFrog>
But the point is, none of that -affects the game-
03:06
< Takyoji>
Yea
03:07
<@ToxicFrog>
Anyways. As a result of all the tool-assistance, this is more like n-dimensional puzzle solving as a spectator sport than like playing the game normally.
03:07
<@ToxicFrog>
And the reason it's a spectator sport is that these runs often look totally awesome.
03:08 Serah [~Z@87.72.36.ns-26407] has joined #Code
03:08 mode/#code [+o Serah] by ChanServ
03:08
<@Derakon>
E.g. the player makes a jump into the abyss, and five seconds of falling later, an enemy wanders into place such that the player bounces off of it.
03:09
<@ToxicFrog>
http://tasvideos.org/Movies-RatingY-Rec.html -- take, for example, the Sonic 3 & Knuckles run, which skips entire acts, or the Mega Man 5 run, which crosses levels by standing on his own projectiles.
03:10
<@Derakon>
This Legend of Zelda run never picks up either the White or Magic swords, for example.
03:12
<@Derakon>
Probably my favorite so far is the any% TAS of Super Metroid, though.
03:12
<@Derakon>
Which, for its first boss, kills Phantoon.
03:18
<@Derakon>
Hmm...apparently all you really need in Zelda for usable gear is a sword, bombs, a candle, the bow and arrows, and a hunk of meat.
03:27 Derakon is now known as Derakon[AFK]
03:35 Reiver is now known as ReivClass
03:42 Pi [~sysop@Nightstar-6875.hsd1.wa.comcast.net] has quit [Quit: There is no justice. There is only me.]
03:55 Thaqui [~Thaqui@Nightstar-26109.jetstream.xtra.co.nz] has joined #code
03:55 mode/#code [+o Thaqui] by ChanServ
04:10 Derakon[AFK] is now known as Derakon
04:44
<@Derakon>
Hrmph...persisting maps is gonna be a bit trickier than I thought, because the map only holds references to specific objects, not the objects themselves (and *that* is because the maps are meant to represent the world before it starts doing anything).
04:44
<@Derakon>
So when I reconstruct the map, I need to re-initialize all the objects that are referred to.
05:19 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has left #code [Leaving]
05:47
<@Derakon>
Hrmph...what's the Lua equivalent of "continue"?
05:47
<@Derakon>
PIL's section on control flow doesn't have it that I can tell.
05:49 Chalcedon is now known as ChalcyVet
05:52 * Derakon nukes ttoa somehow, whee!
05:53
<@ToxicFrog>
That's because Lua has no continue keyword.
05:54
<@Derakon>
That's annoying. I like 'continue'.
05:54
<@ToxicFrog>
So do I. The semantic equivalent is to put the loop body in a location function.
05:54
<@ToxicFrog>
Then you do the loop like so:
05:54
<@ToxicFrog>
for whatever do
05:54
<@ToxicFrog>
if loop_body(...) then break end
05:54
<@ToxicFrog>
end
05:54
<@ToxicFrog>
(location function? local function)
05:54
<@Derakon>
Ahh, I was wondering.
05:55
<@ToxicFrog>
And then, within the function, 'return' is continue and 'return true' is break.
05:55
<@Derakon>
...I think I'll just settle for putting a conditional block inside the for loop.
05:56
<@ToxicFrog>
That's ugly, though~
05:56
<@Derakon>
Indeed.
05:56
<@ToxicFrog>
Anyways. I'm really truly off to bed now. Talk to you tomorrow.
05:56
<@Derakon>
It does, however, keep the actions of the loop physically inside the loop itself.
05:56
<@Derakon>
Night. Thanks again.
05:56
<@Derakon>
Sleep well.
05:56
<@ToxicFrog>
(you can put the function declaration inside the loop, but I'm not sure if that causes it to redeclare it with each iteration. Probably.)
05:57
<@Derakon>
This is what JIT compilation-into-bytecode is for. ¬.¬
05:58 KBot [~karma.bot@Nightstar-28987.neoplus.adsl.tpnet.pl] has joined #Code
05:58 FortMadeOfBones [~farkoff@Nightstar-7096.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
05:58 KarmaBot [~karma.bot@Nightstar-7096.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
05:59 KBot is now known as KarmaBot
06:04 AnnoDomini [~farkoff@Nightstar-28987.neoplus.adsl.tpnet.pl] has joined #Code
06:04 mode/#code [+o AnnoDomini] by ChanServ
06:06 You're now known as TheWatcher
06:08 MahalGone is now known as Mahal
06:09
<@Derakon>
Mental note: don't dump one of TF's Object tables with TF's ttoa function. O_o
06:21
<@Derakon>
Hah! It works! It works!
06:22 ReivClass is now known as Reiver
06:24 ChalcyVet is now known as Chalcedon
06:34 * Derakon is in yr base, serializin' yr mapz.
06:53 GeekSoldier [~Rob@Nightstar-3225.pools.arcor-ip.net] has joined #code
06:54 Derakon is now known as Derakon[AFK]
06:55 GeekSoldier is now known as GeekSoldier|work
07:39 Vornicus-Latens is now known as Vornicus
07:54 Chalcedon is now known as ChalcyAFK
07:54 Forjadon [~Forjadon@Nightstar-1216.ue.woosh.co.nz] has joined #code
07:54 mode/#code [+o Forjadon] by ChanServ
07:55 Forjadon is now known as Chalcedon
08:32
<@TheWatcher>
Hrm, does mingw have equivalents of the int##N##_t and u_int##N##_t types from *nix?
08:34
<@TheWatcher>
If so, where?
08:37
<@TheWatcher>
.. stdint.h, only it calls the unsigned versions uint##N##_t, wonderful
08:38
<@Vornicus>
I thought that was the usual name.
08:39 * TheWatcher has always used the u_ versions, but it seems ones with and without the _ are used
08:39
<@TheWatcher>
so *shrug*
08:45
< Reiver>
http://community.livejournal.com/techsupport/1368038.html
08:48
<@TheWatcher>
... AHAHAHAHAHAHAHAH
08:48 Chalcedon is now known as ChalcyMovie
08:49
<@TheWatcher>
I feel sorry for the folks who had to fix that mess, but surely someone can't be /that/ dumb. Oh, wate, yes then can.
08:51
< Reiver>
I just love the smug self-assuredness of the 'eco-friendly' email.
08:51
< Reiver>
Tone, I mean.
08:51 EvilDarkLord is now known as Jo}{n
08:51
< Reiver>
This person thought they were being Clever and Smug about Helping The Enviroment.
08:52
<@Mahal>
This is why NOBODY except IT staff have /any/ access to the server room.
08:52
<@Mahal>
Except the security guys.
08:52
<@Mahal>
all three of them.
08:52
<@Mahal>
who understand the rules re: the server room.
08:55
<@TheWatcher>
Gain access to the server room unless accompanied by a trained member of the admin staff will immediately get you fired, and could get you in legal trouble, where I am. Partly because of the halon dispensers, but for various other H&S reasons too.
08:55
<@TheWatcher>
*Gaining
08:57 Serah is now known as Ev3
10:43 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
10:43 mode/#code [+o gnolam] by ChanServ
10:48 ChalcyMovie [~Forjadon@Nightstar-1216.ue.woosh.co.nz] has quit [Quit: Leaving]
10:55 ChalcyAFK [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has quit [Quit: Gone]
12:50
<@ToxicFrog>
TheWatcher: uint*_t is the name in both mingw and linux.
12:50 * TheWatcher nods
12:50
<@TheWatcher>
I was looking for u_int*_t versions, which only seem to exist on linux
12:55
<@gnolam>
Well, the former are C99 while the latter are... not.
13:25 Thaqui [~Thaqui@Nightstar-26109.jetstream.xtra.co.nz] has left #code [Leaving]
13:26 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has quit [Operation timed out]
13:33 MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has joined #code
14:12 ReivOut [~reaverta@IRCop.Nightstar.Net] has joined #Code
14:13 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Killed (Joshua (Ghostbusting.))]
14:13 ReivOut is now known as Reiver
14:59 You're now known as TheWatcher[afk]
15:38 GeekSoldier|work is now known as GeekSoldier
16:08 You're now known as TheWatcher
16:42 Jo}{n is now known as EvilDarkLord
16:43 Reiver is now known as ReivSLEP
17:20 You're now known as TheWatcher[afk]
18:42 GeekSoldier [~Rob@Nightstar-3225.pools.arcor-ip.net] has quit [Ping Timeout]
18:52 GeekSoldier [~Rob@Nightstar-3748.pools.arcor-ip.net] has joined #code
18:59 You're now known as TheWatcher
19:00 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
19:40 Chalcedon [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has joined #code
19:40 mode/#code [+o Chalcedon] by ChanServ
19:51 Mahal is now known as MahalGone
19:58
<@TheWatcher>
Hm. mingw doesn't appear to have backtrace() or backtrace_symbols(). This is.. irritating.
19:58 Chalcedon is now known as ChalcyAFK
19:59
<@TheWatcher>
... and looking at the StackWalk() prototype, I'm reminded why I detest the windows API
20:10
< MyCatVerbs>
I wonder if it's sanely possible to partially apply Prolog without brain damage.
20:46 GeekSoldier is now known as GeekSoldier|Sleep
23:18 You're now known as TheWatcher[T-2]
23:21 You're now known as TheWatcher[zZzZ]
23:23 TakyojiClone [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
23:24 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Killed (NickServ (GHOST command used by TakyojiClone))]
23:24 TakyojiClone is now known as Takyoji
23:54 ChalcyAFK is now known as Chalcedon
--- Log closed Thu May 31 00:00:37 2007
code logs -> 2007 -> Wed, 30 May 2007< code.20070529.log - code.20070531.log >