lua-users home
lua-l archive

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


Hello,

please consider this code:

WORKDIR = "foo"
FILETOTRACK = "bar"
dosomething(WORKDIR .. "/" .. FILETOTRACK)

dosomething() is a C function that stores a char * pointer to the string,
which needs to be valid even after this function returns.

What is the lifetime of the string passed to dosomething()? Will it
eventually be garbage-collected sometime after dosomething() has
returned? So, would dosomething() have to make a copy of the string?

- Christian