public static int print(IntPtr L)
{
if (HobaDebuger.GameLogLevel < LogLevel.Log)
{
return(0);
}
// For each argument we'll 'tostring' it
int n = LuaDLL.lua_gettop(L);
string s = String.Empty;
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);
string ret = LuaDLL.lua_tostring(L, -1);
if (ret == null)
{
HobaDebuger.LogError("!!!! lua print return null*");
}
else
{
s += ret;
}
if (i < n)
{
s += "\t";
}
LuaDLL.lua_pop(L, 1); /* pop result */
}
#if !SERVER_USE
if (!EntryPoint.Instance.IsInited)
{
LuaDLL.HOBA_LogString(HobaText.Format("print LUA: {0}", s));
}
#endif
HobaDebuger.LogFormat("LUA: {0}", s);
return(0);
}