|
On 2-Jul-07, at 3:05 PM, SosCpdTerra wrote:
What are you talking about? I cannot pass this return value to a variableand typecast into whatever I want? I guess this is the evil!!
If you want a mutable copy of the string, you need to make a copy of the string.
Like: I have this void figureout(char *what, int ever) and I must his 2 args came from lua. Im trying to do this: int serial(lua_State *L) //my registered function { int argc = lua_gettop(L); const char var1 = lua_tostring(L, 1); int var2 = int(lua_tonumber(L, 2)); figureout(var1, var2); return 0; } There is another way? I can't see that way, and that is my problem.
Declare figureout properly: void figureout(const char *what, int ever)Functions which take string arguments and do not modify them should not be declared as taking char *.