[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: simple question
- From: "Curt Carpenter" <curtc@...>
- Date: Wed, 4 Sep 2002 16:38:03 -0700
As doc'd (4.0):
This function returns a pointer to a string inside the Lua environment.
Those strings always have a zero ('\0') after their last character (as
in C), but may contain other zeros in their body. If you do not know
whether a string may contain zeros, you should use lua_strlen to get its
actual length. Because Lua has garbage collection, there is no guarantee
that the pointer returned by lua_tostring will be valid after the
respective value is removed from the stack.
Curt
-----Original Message-----
From: Bram Vaessen [mailto:bram.vaessen@wxs.nl]
Sent: Wednesday, September 04, 2002 2:04 PM
To: Multiple recipients of list
Subject: simple question
simple question:
If I have a normal lua function that returns a string, and I call this
function from C, and use lua_tostring to get the string. Do I need to
copy the string into another string if I want to keep it. And if not,
then I guess I have to take care of deleting the string if it's not
needed anymore?
Thanks,
Bram Vaessen