当用lua_call()函数时,其输出结果直接在标准输出,请问,怎样可以用字符串去接收这个结果呢?
while (fgets(buff, sizeof(buff), stdin) != NULL)
{
error = luaL_loadbuffer(L, buff, strlen(buff),
"line") || lua_pcall(L, 0, 0, 0);
if (error)
{
fprintf(stderr, "%s", lua_tostring(L, -1));
lua_pop(L, 1);/* pop error message from the stack */
}
}
这段代码是网上找的lua解释器的代码,在调用lua_pcall()后他的执行结果就直接输出在标准输出上了,
我现在想得到这个结果,好用socket传到远程的电脑上显示,请各位高手帮帮忙指导一下。。。