[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Setting 'div' tag method on strings
- From: James Hearn <james.hearn@...>
- Date: Mon, 26 Mar 2001 10:10:18 -0600
James Hearn wrote:
>
> Is it possible to set the 'div' tag method on strings? I'm getting an
> error saying that it's not :( That makes things more complicated on this
> end... What *is* it possible to set 'div' for?
>
> --James Hearn
I should probably elaborate. I'm integrating the lua interpreter into
the 3d engine The Nebula Device. By default it uses Tcl for control. I
thought it would be cool to use lua instead :) However, I've run into
some problems.
The script interpreter (is supposed to) provide a command-shell style
interface to the engine. I've gotten some pretty decent integration - I
can execute commands like:
"go '/sys/servers/time'; print(gettime())"
or:
"go '/sys/servers'; print(time.gettime())"
or:
"go(sys); go(servers); print(time.gettime())"
But I can't do things like "print(/sys/servers/time.gettime())", which
would be ideal for an interactive prompt. I thought I could do some
hackish things like overload the divide operator to say things like
print(_/sys/servers/time.gettime()) but it doesn't seem that I can
overload 'div' for strings. If I make _ one of my userdata values I can
overload that - I can do "go(_/sys/servers/time); print(gettime())", but
"print _/sys/servers/time.gettime()" is still out of the question.
What I have now is nowhere near as nice and clean as the Tcl equivalent.
Am I just barking up the wrong tree here? Should I pack it up and learn
Tcl? Should I just accept the clunkiness of how things are now? Should I
make a 'do' function that does stuff like:
"do ('/sys/servers/gfx.setclearcolor', 0, .2, .3, 0)" ?
I was kind of hoping to hide a lot of the string-passing nature of the
behind-the-scenes stuff here.
Any advice, suggestions, or comments would be appreciated. I'm just
about at a loss here. I can post code if you want, but I'm not sure how
much it would help.
--James Hearn