[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String parameters when calling C from Lua
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 19 May 2006 07:10:33 -0300
> When calling a C function from lua with a string argument, is that
> string copied onto the stack that the C function gets? Or does the stack
> contain a pointer to the original string?
Neither. The stack contains a Lua value, which can be converted to
a C string (const char*) with lua_tostring. The pointer returned by
lua_tostring points to the internal copy of the string inside Lua.
--lhf