Re: Scripting Systems

Brian Hook <[email protected]>
Newsgroups gmane.games.devel.general
Message-ID <200412817714.135123@GATEWAY>
So I finally am getting around to using Lua "in anger" (i.e. in real 
honest to God code), with Nick Trout as my personal coach to see me 
through the (one step better than horrible) documentation.

And what I've learned so far is that scripting, while cool in theory, 
is really a pain in the ass in a lot of practical ways, most of it 
having to do with type checking and basic things of that ilk.

My most common programming errors are simply mechanical:

1.  Accidentally typing object:method() instead of object.method() or 
vice versa

2.  Forgetting that table.foo() isn't called ON the table but WITH the 
table, i.e. it's table.insert( t, ... ) not t:insert( t )/t.insert()

3.  Typographical/memorization errors:

function object.foo( x, y, z )
....
end

o.foo( y, x, z ) -- oops!

or:

function client.create()
	local c = { client_name = "Default" }
	return c
end

c = client.create()
c.name = "Brian Hook" -- oops!

or

-- oops, forgot the 'then'!
if c.client_name == "Brian Hook"
   c:doSomething()
end

Finding these (often trivial) problems requires me to load and run my 
scripts, and in some cases I have to get into pretty entrenched areas 
of my code (e.g. AI that responds to being attacked, etc.).  It really 
sucks to load up a game, spend 5 minutes getting a particular 
condition to occur, then having things barf/not work because you typed 
"nname" instead of "name"...

This is all embedded as well, so using a development environment 
doesn't seem feasible (but I haven't looked into them enough to say).  
Also, because of the reliance on calls back into my main kernel, I 
can't exactly make independent unit tests that run with the command 
line interpreter.

Do other languages handle this any better?  JavaScript suffers from 
the same problems since it is also prototype-based (a la SELF et. 
al.).  

Brian




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_idU7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.