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

Let me ask a different question:

Out of the two implementations I sketched out, would there be any
significant performance difference between them? Basically I am
interested in the relative efficiency of passing strings vs numbers from
lua to C.

>From what you say I suspect that there is no real difference. Which
means I should go with the solution that will be easiest to maintain.

- DC