lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

In my experience, if you want to keep the string once you allow Lua to
continue (ie by returning from your C function, or calling other Lua code),
the string is then potentially able to be collected if all references are
removed.  So while within your function, or before allowing Lua to continue,
you can use the string as you please... but if you want to keep hold of it,
you must copy it.

Love, Light and Peace,
- Peter Loveday
Director of Development, eyeon Software

----- Original Message -----
From: "Bram Vaessen" <>
To: "Multiple recipients of list" <>
Sent: Wednesday, September 04, 2002 5:04 PM
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
> not needed anymore?
> Thanks,
> Bram Vaessen