[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How is string passed from Lua to C
- From: Michal Kottman <k0mpjut0r@...>
- Date: Wed, 7 Dec 2011 15:04:03 +0100
On 7 December 2011 13:43, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> So in case of string, is the C stack able to access the Lua address
>> space where I have stored the string?
>
> Yes. lua_tostring gives you that address. Use it freely while the string
> is in the Lua/C stack. Just don't save that address for later unless
> you're positive that the string won't be collected.
Just a reminder - do not attempt to modify the string you get from
Lua. If you need to change it, you should copy it into your own
buffer.