public static int print(IntPtr L)
{
// For each argument we'll 'tostring' it
int n = LuaDLL.lua_gettop(L);
string s = String.Empty;
//LuaDLL.lua_getglobal(L, "debug");
//LuaDLL.lua_getfield(L, -1, "traceback");
//LuaDLL.lua_pushvalue(L, 1);
//LuaDLL.lua_pushnumber(L, 2);
//LuaDLL.lua_call(L, 2, 1);
//n = LuaDLL.lua_gettop(L);
LuaDLL.lua_getglobal(L, "tostring");
for (int i = 1; i <= n; i++)
{
LuaDLL.lua_pushvalue(L, -1); /* function to be called */
LuaDLL.lua_pushvalue(L, i); /* value to print */
LuaDLL.lua_call(L, 1, 1);
if (i > 1)
{
s += "\t";
}
s += LuaDLL.lua_tostring(L, -1);
LuaDLL.lua_pop(L, 1); /* pop result */
//LuaDLL.PrintCmd(s);
}
Debug.Log("LUA: " + s);
return(0);
}