Is it possible to add a function to Lua via C++ that returns a string? -edit- Ok, this code wont work. Any help?
int flua_getinput(lua_State *L){
if(lua_isstring(L,1)){
cout << lua_tostring(L,1);
cin >> input;
cout << "\n";
lua_pushstring(L,input);
}else{
cin >> input;
cout << "\n";
lua_pushstring(L,input);
}
return 1;
}
Registering Function:
lua_register(L,"getinput",flua_getinput);