lua-users home
lua-l archive

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


> 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