New Message: Re: Manipulating a returned Table
webmaster at userland.com
webmaster at userland.com
Wed Oct 3 11:34:32 PDT 2001
A new message was posted:
Address: http://frontier.userland.com/discuss/msgReader$8841
By: Brian V. Hughes (brianvh at dartmouth.edu)
/Note that where possible it's better just to pass the address to the table around, rather than the table itself. Passing the table required it to be copied and that uses more memory and is slower./
The one exception to this rule being those times when you don't want the calling script to have to wait around for the called script to finish executing. Fortunately, for those cases, thread.callScript is a great solution.
It handles the temporary persistence necessary for the table entries to be used in the called script's local variable scope. Of course, you need to make sure you are using good variable names, otherwise your script ends up being filled with a lot of ["My Bad Table Entry"] references.
Also, in the case where it's the called script that wants to return a table of values to the calling script, what you can do is create a local table variable in the calling script and then pass its address to the called script. In the called script you simply fill in the entries of adrTable^.[whatever], rather than build a local table variable in the called script that you have to pass back. You can certainly do that, but when you have a lot of entries, and/or a lot of data, filling the tabl through an address reference is way more memory efficient.
-Brian
This is a Manila site.. http://manila.userland.com/.
More information about the Frontier-Server
mailing list