code logs -> 2007 -> Mon, 28 May 2007< code.20070527.log - code.20070529.log >
--- Log opened Mon May 28 00:00:20 2007
00:51 GeekSoldier is now known as GeekSoldier|Sleep
01:46 Serah [~Z@87.72.36.ns-26407] has quit [Ping Timeout]
01:49 Serah [~Z@87.72.36.ns-26407] has joined #Code
01:49 mode/#code [+o Serah] by ChanServ
02:31
<@Derakon>
Hmm...so, looks like I've finally fixed my collision detection/basic physics engine.
02:31
<@Derakon>
It doesn't handle walking on acute angles very well, but I can live with that.
02:32
<@Derakon>
So what should I do next? I was thinking maybe I should work on a map editor...
02:43 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
03:00 Derakon is now known as Derakon[AFK]
03:22 Vornicus-Latens is now known as Vornicus
04:38 Chalcedon [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has quit [Ping Timeout]
04:38 Chalcedon [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has joined #code
04:38 mode/#code [+o Chalcedon] by ChanServ
04:39 You're now known as TheWatcher
05:51 Derakon[AFK] is now known as Derakon
06:05 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #Code
06:05
< ReivUni>
So
06:06
< ReivUni>
In the interests of not filling #Fleet with stupid questions about code...~
06:06
< ReivUni>
Once you've #included the lua, how do you, uh, /use it in your C/?
06:06
<@Derakon>
Hang on, Reiver; I'll post my scriptmaster.cpp file.
06:07
<@Derakon>
http://66.235.60.44/~chriswei/temp/scriptmaster.cpp
06:07
<@Derakon>
Skip down to the constructor.
06:08
<@Derakon>
The ScriptMaster class basically exists to hide Lua from my game engine.
06:08
<@ToxicFrog>
ReivUni: you create a lua_State, an object that represents a Lua virtual machine.
06:08
<@ToxicFrog>
You communicate it using its stack; you can push stuff onto the stack, pop things from it, call functions through it, set variables, etc.
06:08
<@ToxicFrog>
You can also push /C/ functions into it so that Lua can call them.
06:09
<@Derakon>
That would be the lua_pushcfunction calls.
06:09
<@ToxicFrog>
The details should be at http://www.lua.org/manual/5.1/manual.html#3, but I can't check that because my DNS server is ded.
06:11
<@Derakon>
Hrmph. The IP address should be 87.237.62.181 but it won't give me anything when I try to use that instead of www.lua.org.
06:11
<@ToxicFrog>
Well, yes, because you aren't sending the Host: line.
06:11
<@Derakon>
Err?
06:12
<@ToxicFrog>
HTTP 1.1 mandates a header, Host:, which tells the server which hostname you accessed it from.
06:12
<@ToxicFrog>
This makes it possible for multiple domains to share an IP address.
06:12
<@Derakon>
Ahh.
06:12
<@Derakon>
Fair enough.
06:12
< ReivUni>
So you just call lua.doStuff(args); in your C/C++, and then in your Lua is where you write all your functions et al?
06:13
<@ToxicFrog>
well, you call lua_doStuff(luaVM, args)
06:13
<@ToxicFrog>
Since it's all in C.
06:13
< ReivUni>
Right, but, you know.
06:13
<@ToxicFrog>
If you mean actually calling Lua functions, it's more like:
06:13
< ReivUni>
(Sorry. The Java has apparently overwritten most of my C in my head.)
06:13
<@ToxicFrog>
lua_getglobal(L, functionname)
06:13
<@ToxicFrog>
lua_pushinteger(L, arg1)
06:14
<@ToxicFrog>
lua_pushstring(L, arg2)
06:14
<@ToxicFrog>
lua_call(L, 2, LUA_MULTRET)
06:14
<@Derakon>
http://66.235.60.44/~chriswei/temp/scriptmaster.cpp , again, has some practical examples.
06:14
<@Derakon>
Not that there's much explanation, though.
06:15
<@ToxicFrog>
I did link the Manual;.
06:15
< ReivUni>
Der: Not to be offensive/lazy, but I'm trying to keep my head full of documentation on bogs~
06:15
<@Derakon>
Fair enough.
06:15
< ReivUni>
Thus I am plagued by Curiosity but can't afford to infodelve too deeply.
06:15
<@Derakon>
TF: I find that the Manual doesn't always get to the point sufficiently quickly. Working examples are useful.
06:15
<@ToxicFrog>
Huh. I found the manual to be both clear and concise.
06:16
< ReivUni>
As such, -- what Der said. I mostly just sort of can't afford to read pages to get the quick-and-dirty gist, 'cuz that means I'd then have to turn around and switch off the Code bit and switch on the Bogs bit and then /reread all my stuff/
06:16
<@Derakon>
Okay, in short, you know how C has a program stack? Lua has it too, and to do things in Lua from C, you directly manipulate the stack.
06:17
< ReivUni>
And /then/ start writing more of my essay. I dunno if that makes my memory odd or not, but it's what I've found happens. >.>
06:17 * ToxicFrog shrugs. The manual explains it better than I can.
06:17
< ReivUni>
Aah. Shiny.
06:17
<@Derakon>
Well, any program has a program stack.
06:17
<@ToxicFrog>
But perhaps you should learn Lua after finishing the exam :P
06:17
<@Derakon>
Heh. Yes.
06:17
< ReivUni>
TF: I intend to!
06:17
<@ToxicFrog>
(exam? Essay.)
06:18
< ReivUni>
But also can't concentrate if I am obsessing over how Lua might do things instead of thinking about the Glorious Nature Of Our Bogs(tm).
06:18
<@Derakon>
If all goes well, I'll open-source my engine once I've finished my game, and then you can go not just look at my code, but tweak it. ¬.¬
06:24
<@Derakon>
So! I think I have working collision detection and basic physics. What should I work on now? I was thinking maybe a level editor/creator; sound good?
06:25
< ReivUni>
Do you have an interface?
06:25
< ReivUni>
Monsters?
06:25
<@Derakon>
How d'you mean, interface? And no, no monsters yet.
06:25
<@Derakon>
Not much point in writing enemies when they can't stand on the ground properly.
06:30 * ToxicFrog sleep
06:30
<@Derakon>
Night.
06:33 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC (Ping timeout)]
07:03 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #Code
07:03
< ReivUni>
That was fun.
07:03
<@Derakon>
Essay done?
07:03
< ReivUni>
Hell on
07:03
< ReivUni>
*no
07:03
< ReivUni>
But I've now eaten subway for dinner, thus meaning I have had *2* meals today!
07:03
< ReivUni>
zomg etc.
07:04
<@Derakon>
Le ghasp!
07:05
< ReivUni>
(I usually manage only one.)
07:05
< ReivUni>
(I was also getting tired, for essaying takes Energy.)
07:05
<@Derakon>
That's not so great for your metabolism.
07:05
< ReivUni>
No shit.
07:05
< ReivUni>
Sideaffect of some other medications I take is appetite suppressant, however.
07:05
<@Derakon>
Ach.
07:05
< ReivUni>
And, uh
07:06
< ReivUni>
I have memory impairment to start with ??
07:06 MahalGone is now known as Mahal
07:06
< ReivUni>
Thus I... just don't eat.
07:06
< ReivUni>
No particular angst or problem with it, I just... never get around to it.
07:06
<@Derakon>
Heh.
07:07
< ReivUni>
Not hungry. Don't remember to eat out of habit.
07:07
<@Derakon>
I do occasionally get sufficiently involved in something that I forget to eat, but it's not common.
07:07
< ReivUni>
Realise about 9PM at night I should probably, like, eat something for the day.
07:07
< ReivUni>
Cook food, Eat food, go to bed. Metabolism, how I pity you. >.>
07:10 ReivUni [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC (EOF)]
07:12
<@Derakon>
Night, Dor.
07:13
<@Derakon>
Night, SA.
07:13 * Derakon coughs. "Wrong channels, both times."
07:28 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Quit: Leaving]
07:30 Derakon is now known as Derakon[AFK]
08:01 GeekSoldier|Sleep is now known as GeekSoldier
08:32 Forjadon [~Forjadon@Nightstar-1216.ue.woosh.co.nz] has joined #code
08:32 mode/#code [+o Forjadon] by ChanServ
08:54 KBot [~karma.bot@Nightstar-29205.neoplus.adsl.tpnet.pl] has joined #Code
08:55 AnnoDomini [~farkoff@Nightstar-29537.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
08:55 KarmaBot [~karma.bot@Nightstar-29537.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
08:55 KBot is now known as KarmaBot
09:00 AnnoDomini [~farkoff@Nightstar-29205.neoplus.adsl.tpnet.pl] has joined #Code
09:00 mode/#code [+o AnnoDomini] by ChanServ
09:02 You're now known as TheWatcher[afk]
09:32 Mahal is now known as MahalGone
09:33 MahalGone is now known as MahalBedd
09:42 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
09:42 mode/#code [+o gnolam] by ChanServ
09:43 You're now known as TheWatcher
09:58 ReivClass is now known as Reiver
10:11 Forjadon is now known as ProofReader
10:12 ProofReader is now known as Chalcorj
10:40 Chalcorj [~Forjadon@Nightstar-1216.ue.woosh.co.nz] has quit [Quit: Leaving]
10:42 Chalcedon [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has quit [Quit: Gone]
11:52 GeekSoldier is now known as GS|Out
12:19 GS|Out is now known as GeekSoldier
13:10
<@Vornicus>
"Simple is better than complex. This idea extends to the parser. Restricting Python's grammar to an LL(1) parser is a blessing, not a curse. It puts us in handcuffs that prevent us from going overboard and ending up with funky grammar rules like some other dynamic languages that will go unnamed, like Perl."
13:12
< GeekSoldier>
"... that will go unnamed, like perl." hahaha.
13:12
<@Vornicus>
exactly
13:12
< GeekSoldier>
this was written be Guido?
13:13
<@Vornicus>
Georg Brandl. This is PEP 3099, "Things That Will Not Change In Python 3000"
13:13
<@Vornicus>
"The interpreter prompt (>>>) will not change. It gives Guido warm fuzzy feelings."
13:14
< GeekSoldier>
hehe. I like it too.
13:17
<@Vornicus>
THere appears to have been a proposal for it to be changed to "py>", which is okay, but I like >>> better anyway.
13:36
< Reiver>
...Why would you change Pythons grammar to be parsable in anything but LL(1)? O.o
13:36
< Reiver>
Is it somehow a good idea to be able to parse backwards?
13:37
< Reiver>
In anything other than obscupification contests, I mean?
13:38 * AnnoDomini spots a DSK typo. :P
13:39
<@AnnoDomini>
Or not.
13:39
<@Vornicus>
DSK?
13:39
<@AnnoDomini>
Dvorak Standard Keyboard. Somehow, I thought that p was next to r, which it isn't.
13:40
< GeekSoldier>
no, p is between . and y
13:40
<@AnnoDomini>
I know.
13:40
<@AnnoDomini>
I use it.
13:41 * AnnoDomini wonders how Reiver typo'd 'obscurification', then.
13:41
< GeekSoldier>
especially when it should be 'obfuscation'
13:43
< Reiver>
Uh
13:43
< Reiver>
Because I can't spell?
13:44
< Reiver>
And have not actually pronounced the word in real life, thus am trying to phonetically spell a word I have never heard, whilst a mild dyslexic?
13:44
< Reiver>
¬¬
13:44
< GeekSoldier>
ah fair enough.
13:45 * GeekSoldier jackasses.
13:45
< GeekSoldier>
i mean.
13:45 * GeekSoldier <=- jackass.
13:45
<@AnnoDomini>
If you're a jackass, who am I by comparison?
14:04
<@Vornicus>
...okay, maybe I /won't/ submit a patch to Python. That code is fucking scary.
14:06
< GeekSoldier>
what were you going to patch, Vorn?
14:07
<@Vornicus>
I wanted to see if I could add Ruby-like numeric literals to Python - Ruby uses _ as a group separator.
14:08
< GeekSoldier>
didn't Python do that too?
14:08
< GeekSoldier>
guess not.
14:08
<@Vornicus>
Nope.
14:43 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Client exited]
14:59 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
14:59 mode/#code [+o ToxicFrog] by ChanServ
15:24
< Reiver>
!256/60
15:24
< KarmaBot>
[Reiver] 256/60 = 4.266667.
15:24
< Reiver>
That'll do.
15:37 Reiver is now known as ReivZzz
17:10 You're now known as TheWatcher[afk]
17:16 * Vornicus fiddles with a Crazygonuts regex.
17:52 Derakon[AFK] is now known as Derakon
18:13 You're now known as TheWatcher
18:41 GeekSoldier_ [~Rob@Nightstar-3354.pools.arcor-ip.net] has joined #code
18:42 GeekSoldier [~Rob@Nightstar-6687.pools.arcor-ip.net] has quit [Killed (NickServ (GHOST command used by GeekSoldier_))]
18:42 GeekSoldier_ is now known as GeekSoldier
18:50 TakyojiClone [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
19:21 MahalBedd is now known as Mahal
19:25 Ogredude [~user@ServicesAdmin.Nightstar.Net] has joined #Code
19:25
< Ogredude>
wheee!
19:25
< Ogredude>
I got my triangle programs back!
19:25
<@Derakon>
Whoah, it's Ogredude! Haven't seen you in ages.
19:25
<@Derakon>
And, triangle programs?
19:25
< Ogredude>
hiya Derakon!
19:25
< Ogredude>
yep
19:25
< Ogredude>
for my HP-41CV
19:26
<@Derakon>
What's a triangle program, though.
19:26
<@Derakon>
?
19:26
< Ogredude>
ah, it's a little set of programs that solves triangles for you
19:26 * Derakon idly refactors input handling out of the World class, which is doing entirely too much as it is.
19:26
<@Derakon>
Ahh, nice.
19:27
< Ogredude>
if you know any 3 pieces of information about a triangle, including at least one side length, it'll give you all the side lenghts and all the angles and the area
19:27
<@Derakon>
Yeah, I took highschool geometry. :) It's just been a while.
19:27
<@Vornicus>
Not quite
19:27
<@Vornicus>
Angle Side Side has two solutions
19:28
<@Derakon>
(Largest classes: SpriteTree, at 681 lines, then Polygon, at 503 lines, then World, at 367 lines, then ScriptMaster, at 357 lines. I split out 153 from World into ControlMaster)
19:28
<@Derakon>
Simplest class: Layer, at 57 lines.
19:28
<@Vornicus>
(well, technically it can have zero or one, too, but)
19:28
< Ogredude>
Vornicus: yeah, SSA does have two solutions and it does display both solutions.
19:29
< Ogredude>
Vornicus: The program set consists of SSS, ASA, SAA, SAS, and SSA
19:29
< Ogredude>
and if SSA has two solutions, both get shown
19:30
<@Vornicus>
ah, shiny
19:37
<@gnolam>
What about SS and SA?
19:37 * gnolam hides.
19:38 * Ogredude kicks gnolam in the angle, side, side
19:38
<@gnolam>
With jackboots?
19:38 * gnolam hides again.
19:45
<@gnolam>
(I keed, I keed)
19:47 * Vornicus prefers Jimboots.
19:50 Mahal is now known as MahalGone
19:51
< TakyojiClone>
Can anyone see anything wrong with this script? http://deltalabs.net/othercrap/opacity-fader.htm
19:51
< TakyojiClone>
WHen you hover it the opacity is supposed to fade, however it doesn't work
19:53
< TakyojiClone>
In the FOR control structure I've tried to to set 'result' at 50, but when I have it do a little math, it doesn't change the opacity
19:54
< TakyojiClone>
So if I set 'result' statically to 50, it would work. But if I would change it each time it wouldn't work
19:58
<@Vornicus>
What's supposed to happen?
19:58
<@Vornicus>
And, if something is supposed to happen when I point or click, it ain't, on Safari.
19:59 Chalcedon [~Chalcedon@Nightstar-1216.ue.woosh.co.nz] has joined #code
19:59 mode/#code [+o Chalcedon] by ChanServ
19:59
< TakyojiClone>
When you hover it, it's suppose to change the text's opacity
19:59
< TakyojiClone>
But it ironically doesn't work
20:01
< TakyojiClone>
It's all in JavaScript
20:23 TakyojiClone is now known as Takyoji
20:38 Ogredude is now known as Ogredude-Away
20:44 GeekSoldier is now known as GeekSoldier|Sleep
20:49 Ogredude-Away is now known as Ogredude
21:09
<@Derakon>
Hey, TF - does Lua do dynamic dispatch?
21:09
<@Derakon>
Or function overloading, really, is all I need.
21:12
< Ogredude>
oh freakin SWEET
21:12
< Ogredude>
I just found an HP-41CX emulator for Palm
21:29
< Ogredude>
this calc is *SO* amazingly overpowered for what I do
21:29
< Ogredude>
I mean, here's a little program that "Calculates the definite integral in the given interval of an equation f(x) = 0"
21:30
< Ogredude>
"Performs common operations with 2- or 3-dimensional vectors: addition, subtraction, dot product, cross product, distance, angle, norm, and unit vector."
21:30
< Ogredude>
huh.
21:31
<@Derakon>
Heh.
21:31
< Ogredude>
"This program computes Fourier coefficients from samples of a periodic function. Up to ten consecutive pairs of coefficients may be computed at one time from N equally spaced points. The coefficients may be displayed in either rectangular or polar form."
21:31
< Ogredude>
the only person I know of who would know what any of this crap does is Vornicus
21:31
<@Vornicus>
Pi would too.
21:32
< Ogredude>
didn't know he knew this type of math
21:32
< Ogredude>
I sure don't
21:32
< Ogredude>
okay apparently the triangle programs are on the Math pac as well as the Surveying pac, so I don't need the Surveying pac
21:32
<@Vornicus>
He's a mathematician by trade, and he deals with sound. Fourier is /what he gets paid to do/.
21:32
< Ogredude>
ah okay
21:32
< Ogredude>
did not knwo that
21:33
<@Derakon>
Ahh, Fourier transforms.
21:33
<@Derakon>
I learned those in college.
21:33
<@Derakon>
Don't think I remember much about them any more, though.
21:33
< Ogredude>
hrmm
21:33
<@Vornicus>
That said, I know how to work with them.
21:33
< Ogredude>
here's another pac with some interesting stuff I'll never use
21:33
<@Vornicus>
Never got good at them, not like I did with logarithms though.
21:33
< Ogredude>
"Computes the dynamic properties and the design parameters for cams with flat or roller, radial followers."
21:34
< Ogredude>
"Given three angular orientations of the input and output of a four bar linkage, the program sizes the links to conform to the angular orientations."
21:34
<@Vornicus>
Cool.
21:34
< Ogredude>
"Calculates displacement, velocity, and acceleration of the slider and angular velocity and acceleration of the connecting rod for hte progression of a slider crank system."
21:34
< Ogredude>
these are all things that my calculator can do, with the proper programs installed.
21:34
< Ogredude>
this, for a calculator made in 1982
21:34
<@Vornicus>
Yep.
21:35
< Ogredude>
fuckin love this thing
21:35
<@Vornicus>
I often find it incredible how much stuff you can do in only a little computer power.
21:35
< Ogredude>
yeah
21:36
< Ogredude>
but honestly, there's two big reasons I like this calculator so much
21:36
< Ogredude>
first, Dad taught me RPN at an early age, and it's actually more comfortable to me than infix calculating
21:36
< Ogredude>
and second, the keys have a lot of travel and they're clicky. It *feels* good to use.
21:36 * Vornicus finds Postscript relaxing.
21:37
<@Vornicus>
Especially because it's designed to make things.
21:37
< Ogredude>
never played with postscript
21:37
<@Vornicus>
It's good stuff.
21:37
< Ogredude>
but I wonder, what's wrong with EPS as a portable document format
21:37
< Ogredude>
as opposed to PDF
21:37
<@Derakon>
People aren't used to EPS.
21:37
< Ogredude>
everyone wants PDF, and I find PDF incredibly clunky to deal with
21:38
<@Vornicus>
PDF has a lot of cool stuff in it. Also it comes compressed.
21:38
< Ogredude>
it's read-only, it doesn't import well into other documents, and the rendering varies widely depending on which UA is used.
21:38
< Ogredude>
took a PDF to a copy center once, and every last bit of text came out as ???????
21:38
< Ogredude>
the fonts were embedded even
21:38
<@Vornicus>
I've never had trouble with PDF.
21:38
< Ogredude>
so I had to open up the original Corel Draw file and convert all the text to curves and re-export to PDF
21:39
< Ogredude>
which, of course, increased the filesize tenfold
21:39
< Ogredude>
and then it took them three tries to figure out how to set the duplexing option
21:39
<@Vornicus>
EPS I don't think I've ever even seen a document sent in.
21:39
<@Vornicus>
Plain postscript, sure, but
21:39
<@Vornicus>
I think your copy shop is incompetent.
21:40
< Ogredude>
I think so too
21:41
< Ogredude>
I don't know of a single copy shop which IS competent
21:41
< Ogredude>
they don't seem to hire for competence anymore
21:41
< Ogredude>
even dedicated copy centers like Kinko's, if you give them anything more complex than "Here's a sheet of paper. I need three copies of it." they're like "Huh?"
21:42
< Ogredude>
you can't say "Here's a PDF. Print it duplexed, flip on long side, 200 copies and do a business fold on it."
21:42
< Ogredude>
it doesn't work
21:42
< Ogredude>
they don't know what you're talking about
21:42
<@Vornicus>
I never had such troubles.
21:44
<@Vornicus>
I took a 24 page program - 12 PDFs one per page, black & white insides, color covers, got 500, glossy covers, book folded and stapled.
21:44
<@Vornicus>
one per, uh, face, rather
21:45
< Ogredude>
bah
21:45
< Ogredude>
can't do that here
21:45
< Ogredude>
I have to print it out in signatures
21:45
< Ogredude>
err, export to PDF as signatures
21:45
< Ogredude>
it has to be a SINGLE FILE
21:46
<@Vornicus>
I also gave them a sample book, they looked at it and the PDFs, called me up and said "the PDFs and the book don't match for page order. Which one is right?"
21:46
< Ogredude>
and for a half-fold saddle-stitched booklet, I have to make sure that page 1 of the PDF is the front and back covers, page 2 is the inside front and back covers, page 3 is page 1 and last page, page 4 is page 2 and second-to-last page, etc...
21:46
< Ogredude>
and even THEN, it usually takes them three or four proofs to get it right.
21:46
< Ogredude>
and this has universally been my experience
21:47
< Ogredude>
if I ever have anything needs to be letterpressed or single-color offset printed, though, I do know a VERY competent printer right here in town
21:47
< Ogredude>
anyway, I better git
21:47
<@Vornicus>
laters
21:50
<@Derakon>
Seeya, Ogredude.
21:55
<@Vornicus>
Book title: User Interface Design for Mere Mortals.
21:55 Takyoji [~Takyoji@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Quit: Leaving]
22:05 * Derakon tries to work out how to cleanly make maps in Lua.
22:06
<@Derakon>
From my reading of TF's OO Lua code, doing something like "BasicGround:New({frame = 1})" should create a new BasicGround (which it does), with the "frame" field set to 1 (which it does not).
22:13 Vornicus is now known as Vornicus-Latens
22:18
<@ToxicFrog>
That OO code is obsoleted now anyways~
22:18
<@ToxicFrog>
But, ok, how is your __new (I think that's what it was called in that version?) set up?
22:18
<@ToxicFrog>
...and what are the default values?
22:18
<@Derakon>
It's empty. Default value is zero.
22:19
<@ToxicFrog>
That would be why.
22:19
<@Derakon>
...does zero have a value of false in Lua?
22:19
<@ToxicFrog>
The sample constructor only overwrites those that are false in the prototype.
22:19
<@Derakon>
That's gonna be really irritating.
22:19
<@ToxicFrog>
No. nil and false are false, all else is true.
22:19
<@Derakon>
Oh, o kay.
22:19
<@ToxicFrog>
IIRC, __new has something like:
22:19
<@ToxicFrog>
for key,value in pairs(init) do
22:19
<@Derakon>
Yeah.
22:19
<@Derakon>
Okay, that did it. Thanks.
22:19
<@ToxicFrog>
if self[key] == false then self[key] = value
22:19
<@ToxicFrog>
end
22:20
<@Derakon>
Just had to default it to false instead of zero.
22:20
<@ToxicFrog>
You can also just change __new, of course.
22:20
<@Derakon>
Which, honestly, is good. Forces me to specify which kind of terrain I want for every tile I make.
22:20
<@ToxicFrog>
If it makes more sense for it to default to 0 than to a type mismatch error or whatever..
22:20
<@ToxicFrog>
Aah.
22:21
<@Derakon>
I'm folding the terrain type into the "animation frame" field, which is kinda silly but also makes sense given my sprite model.
22:21
<@Derakon>
So e.g. frame 0 is a square block; frame 1 is diagonal with slope = -1, etc.
22:21 * ToxicFrog has moved on to a new OO framework that uses BasicGround(...) instead of BasicGround:New(...) and allows overloads instead of fallbacks, so I don't remember many details of the old one.
22:21
<@Derakon>
Heh.
22:21
<@Derakon>
Once you've stabilized, I should upgrade to your latest version.
22:22
<@ToxicFrog>
It's not as pure, though; it drops into C for about ten lines to create the proxy userdata.
22:22
<@ToxicFrog>
Since otherwise you can'
22:22
<@Derakon>
Given that, assuming this gets at all popular, whatever use case I release is the one that most people will be using (as they'll follow examples instead of forging their own paths).
22:22
<@ToxicFrog>
t overload __len
22:22
<@Derakon>
Eek.
22:22
<@ToxicFrog>
(this is also a minor performance hit, since it has to go proxy->object->member rather than just object->member)
22:23
<@Derakon>
I, um, have no idea where I stand, performance-wise. I need to do a lot of content creation before I'll be able to check optimizations.
22:24
<@Derakon>
Now...how big should my tiles be?
22:25
<@Derakon>
100x100 is *way* too big.
22:32
<@ToxicFrog>
32x32?
22:33
<@ToxicFrog>
And as far as upgrading to the latest OOlua goes...the API is, err, completely different.
22:33
<@Derakon>
Well, better to do it before I invest in a lot of new objects, then. So long as it's still sensical.
22:33
<@ToxicFrog>
So unless you really need operator overloads, probably better to stick with what you currently have.
22:33
<@ToxicFrog>
Aah. Well then.
22:34
<@ToxicFrog>
Currently it's basically:
22:34
<@Derakon>
Right now I have a single terrain block and a stick figure.
22:34
<@ToxicFrog>
SubClass = Class(SuperClass)
22:34
<@ToxicFrog>
Upon which you can:
22:34
<@ToxicFrog>
(1) alter SubClass directly, which alters the class metadata
22:34
<@ToxicFrog>
(2) alter SubClass.def, which alters the prototype
22:35
<@ToxicFrog>
(3) call SubClass:startdef(), define a bunch of stuff, and then call enddef(), which puts it into the prototype automatically
22:35
<@ToxicFrog>
So a typical def looks something like
22:35
<@ToxicFrog>
Foo = Class(Bar)
22:35
<@ToxicFrog>
Foo:startdef()
22:35
<@ToxicFrog>
member = value
22:35
<@ToxicFrog>
function method(self, ...)
22:35
<@ToxicFrog>
end
22:35
<@ToxicFrog>
enddef()
22:35
<@ToxicFrog>
Note that Class is itself a class, and can be subclassed.
22:35
<@ToxicFrog>
(it's also an object)
22:35
<@Derakon>
Seems like you should be able to just append a table to Foo, overwriting any duplicate entries.
22:36
<@ToxicFrog>
"append a table to"?
22:36
<@Derakon>
Well, Foo is basically a table, yes? Maps field names to values, et cetera.
22:36
<@ToxicFrog>
Yes.
22:36
<@Derakon>
So instead of having that function there, it'd be nice if you could do something like:
22:36
<@Derakon>
Foo = Class(Bar)
22:37
<@Derakon>
Foo.append( {member = value, method = function(self, ...)})
22:37
<@Derakon>
Where this append function would be some Lua builtin that just adds fields to an existing table using the table constructor syntax.
22:38
<@ToxicFrog>
Oh. Yeah, that's also doable.
22:38
<@ToxicFrog>
Like I said, Class is subclassible.
22:38
<@ToxicFrog>
Class = Class(Class)
22:38
<@Derakon>
I'll grant that your method does a little more "You don't need to understand how Lua works to use this".
22:38
<@ToxicFrog>
Class.def.append = function(self, table) for k,v in table do ........ end end
22:38
<@ToxicFrog>
Class.append = Class.def.append
22:39
<@ToxicFrog>
And now you can go:
22:39
<@ToxicFrog>
Foo = Class(Bar)
22:39
<@ToxicFrog>
Foo:append { .... }
22:39
<@ToxicFrog>
(you don't even need the ())
22:39
<@Derakon>
That was easy. :)
22:39
<@Derakon>
Yeah, but I leave 'em in anyway. Makes me feel better.
22:39
<@Derakon>
Idly, map of Hell Temple: http://ft.mirror.waffleimages.com/files/3b/3b4fb76806a3ed92eb7b7aeb0ddffdffcc6c1 a1d.png
22:40
<@ToxicFrog>
Anyways. I don't have that as a builtin presently because I have putting large amounts of stuff in table constructors.
22:40
<@ToxicFrog>
Function definitions just look nasty and woe betide you if you forget a semicolon.
22:40
<@ToxicFrog>
They are the ugliest part of Lua.
22:40 * Derakon nods.
22:41
<@Derakon>
Right now, what I'm using is your Object/Prototype code.
22:41
<@ToxicFrog>
Yeah. Which also doesn't have that, IIRC.
22:41
<@ToxicFrog>
But it's just as easy to add.
22:41
<@Derakon>
Here's the terrain code: http://pastie.caboo.se/65420
22:42
<@Derakon>
RealObject basically just creates some...ergh, wossname, functions that don't actually do anything, stubs, that's it, as well as some fields that every object is required to have.
22:43
<@ToxicFrog>
BRB, switching network interfaces.
22:45 ToxicFrog` [~ToxicFrog@Admin.Nightstar.Net] has joined #code
22:45
<@Derakon>
Wibwob.
22:45 ToxicFrog` [~ToxicFrog@Admin.Nightstar.Net] has quit [Connection reset by peer]
22:47
<@ToxicFrog>
That shouldn't have happened.
22:47
<@Derakon>
Hm?
22:47 Ogredude is now known as Ogredude-Away
22:55
<@ToxicFrog>
I switched interfaces and then tried to reattach to xchat and it spawned a new process instead.
23:07 GeekSoldier|Sleep [~Rob@Nightstar-3354.pools.arcor-ip.net] has quit [Ping Timeout]
23:09 GeekSoldier|Sleep [~Rob@Nightstar-3354.pools.arcor-ip.net] has joined #code
23:21
<@Derakon>
Oh, and I have a minor problem - if you walk up a 45° slope and onto a flat surface, then about 30% of the time, you spaz out for a few frames. >.<
23:28 Serah [~Z@87.72.36.ns-26407] has quit [Ping Timeout]
23:30 Serah [~Z@87.72.36.ns-26407] has joined #Code
23:30 mode/#code [+o Serah] by ChanServ
--- Log closed Tue May 29 00:00:25 2007
code logs -> 2007 -> Mon, 28 May 2007< code.20070527.log - code.20070529.log >