[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: zero containing strings
- From: David Jeske <jeske@...>
- Date: Mon, 22 Jun 1998 23:04:16 -0700
On Tue, Jun 23, 1998 at 01:46:43AM -0300, Dan Marks wrote:
> Another thing is that I noticed that in lua when lua_getstring()
> is called, it seems to make a copy of the string that is retrieved,
> even if that string is in a variable that is passed as a parameter.
> I tried to change the value of a string by directly writing to
> the string but the changes do not take effect. Is this true,
> and if so, will there be a way to retrieve strings by reference,
> so they don't have to be copied (and possibly could be modified
> in place?). Some strings would be rather long, and it would
> good to avoid copying them excessively, and also it would be useful
> to use a string as preallocated space to store information.
Lua has one global string table. If you modified a string in place you
wouldn't necessarily know all the places it would take effect. For
example, if you happened to modify a string which contained "draw" you
would end up changing the string lookup of any "draw" method names
contained in tables. (Someone please validate that this is correct)
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net