[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How is string passed from Lua to C
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Wed, 7 Dec 2011 14:09:25 +0300
On Wed, Dec 7, 2011 at 1:54 PM, rahul sharma <email@example.com> wrote:
> Can anyone explain me how the string fetching is done by Lua. I want to pass
> string from Lua to C. I am able to access it using gettable and then
> converting it to string using lua_tostring(). But I don't know whether a new
> copy of that string is made on stack or its a reference to the string's
> location. If anyone knows about it, do let me know. My basic motto is to
> avoid the copy of data.
> Thanks and Regards
> Rahul Sharma
1. Putting string into registry will guarantee it's validness during
2. Two equal strings from the same lua_State will return the same
value with lua_tostring ().
That's because string values are unique in Lua.