Ejemplo n.º 1
0
    // /////////////////////////////////////////////////////////////////
    //
    // /////////////////////////////////////////////////////////////////
    void LuaStateManager::PrintDebugMessage(LuaPlus::LuaObject debugObject)
    {
        LuaPlus::LuaObject stringObj;
        const char * pFinalStr = debugObject.ToString();

        // Generate an event.
        const EvtData_Debug_String debugEvent((NULL == pFinalStr) ? "INVALID!" : pFinalStr, EvtData_Debug_String::kDST_ScriptMsg);
        safeTriggerEvent(debugEvent);
    }
// write to the log from lua script
void LuaInternalScriptExports::LuaLog(LuaPlus::LuaObject text)
{
	if (text.IsConvertibleToString())
	{
		CB_LOG("Lua", text.ToString());
	}
	else
	{
		CB_LOG("Lua", "<" + std::string(text.TypeName()) + ">");
	}
}
Ejemplo n.º 3
0
void ant::InternalLuaScriptExports::lualog( LuaPlus::LuaObject text )
{
	if (text.IsConvertibleToString())
	{
		GCC_LOG("Lua",text.ToString());
	}
	else
	{
		GCC_LOG("Lua","<" + std::string(text.TypeName()) + ">");
	}
}
Ejemplo n.º 4
0
void LuaManager::PrintTable(LuaPlus::LuaObject table, bool recursive)
{
	if(table.IsNil())
	{
		if(!recursive)
			GLIB_LOG("LuaManager", "null table");
		return;
	}

	if(!recursive)
		GLIB_LOG("LuaManager", "PrintTable()");

	cout << (!recursive ? "--\n" : "{ ");

	bool noMembers = true;
	for(LuaPlus::LuaTableIterator iter(table); iter; iter.Next())
	{
		noMembers = false;

		LuaPlus::LuaObject key = iter.GetKey();
		LuaPlus::LuaObject value = iter.GetValue();

		cout << key.ToString() << ": ";
		if(value.IsFunction())
			cout << "function" << "\n";
		else if(value.IsTable())
			PrintTable(value, true);
		else if(value.IsLightUserData())
			cout << "light user data" << "\n";
		else
			cout << value.ToString() << ", ";
	}

	cout << (!recursive ? "\n--" : "}");
	cout << endl;
}