function Vector:__tostring()
    return 'Vector (X: '..self.x..', Y: '..self.y..')';
end
-----------------------------------------------------------------------------------

function CAnimation:__tostring()
    local str = "CAnimation (HotX: "..self:GetHotX().." HotY: "..self:GetHotY()
    if self:GetFrames() > 0 then
        str = str..' NFrames: '..self:GetFrames()
    end
    str = str..' Color:'..tostring(self:GetColorStr())..')'
    return str
end
-----------------------------------------------------------------------------------

function CGameObject:__tostring()
    local str = 'CGameObject \n'..
				'   Name: '..self:GetName()..'\n'..
				'   X: '..self:GetX()..' (ScrX: '.. self:GetScrX()..')\n'..
				'   Y: '..self:GetY()..' (ScrY: '.. self:GetScrY()..')\n'..
				'   Z: '..self:GetZ()..' (ScrZ: '.. self:GetScrZ()..')\n';
    if self:GetAnimation():GetFrames() > 0 then
        str = str..
				'   NFrames: '..self:GetAnimation():GetFrames()..'\n';
    end
    str = str.. '   Color:'..tostring(self:GetAnimation():GetColorStr())

	local parent = self:GetParent();
	if (parent) then
	str = str.. '   ParentName: \''..parent:GetName()..'\'\n';
	end
    return str
end
-----------------------------------------------------------------------------------

function CScreenEx:__tostring()
    return 'CScreenEx (Name: \''..self:GetName()..'\')';
end
-----------------------------------------------------------------------------------

function CScriptedGameScreen:__tostring()
	return	'class CScriptedGameScreen \n'..
			'    m_scriptFileName: \''..self:GetScriptFileName()..'\' \n'..
			'    m_screenClassName: \''..self:GetScreenClassName()..'\' \n'..
			'  [class CAutoRegisterEntity] \n'..
			'    Name: \''..self:GetName()..'\' \n'..
			'    bPaused: '..(self:IsPaused() == true and 'true' or 'false');
end
-----------------------------------------------------------------------------------

function CTask:__tostring()
    return 'CTask (text singular: '..self:GetTextSingular()..')'
end
-----------------------------------------------------------------------------------

function CButtonEntity:__tostring()
    return 'CButtonExEntity (Name: \''..self:GetName()..'\')';
end
-----------------------------------------------------------------------------------

function CTextEntity:__tostring()
    return  'class CTextEntity \n'..
		    '   Name: \''..self:GetName()..'\' \n'..
			'   X: '..self:GetX()..' (ScrX: '.. self:GetScrX()..')\n'..
			'   Y: '..self:GetY()..' (ScrY: '.. self:GetScrY()..')\n'..
			'   Z: '..self:GetZ()..' (ScrZ: '.. self:GetScrZ()..')\n'..
		    '   Text: \''..self:GetText()..'\'';
end
-----------------------------------------------------------------------------------

function CompositionElement:__tostring()
	return 	'class CCompositionElement \n'..
			'   Name: \''..self:GetName()..'\' \n'..
--			'	HotXY('..self:GetHotX()..', '..self:GetHotY()..')\n'..
			'   X: '..self:GetX()..' (ScrX: '.. self:GetScrX()..')\n'..
			'   Y: '..self:GetY()..' (ScrY: '.. self:GetScrY()..')\n'..
			'   Z: '..self:GetZ()..' (ScrZ: '.. self:GetScrZ()..')\n';
end
-----------------------------------------------------------------------------------

function CompositionSequence:__tostring()
	return 	'class CCompositionSequence \n'..
			'	Name: \''..self:GetName()..'\' \n'..
--			'	HotXY('..self:GetHotX()..', '..self:GetHotY()..')\n'..
			'   X: '..self:GetX()..' (ScrX: '.. self:GetScrX()..')\n'..
			'   Y: '..self:GetY()..' (ScrY: '.. self:GetScrY()..')\n'..
			'   Z: '..self:GetZ()..' (ScrZ: '.. self:GetScrZ()..')\n';
end
-----------------------------------------------------------------------------------

function vector_string:__tostring()
	local str = 'class vector_string (std::vector<std::string>>)\n';
	for i = 0,self:size() - 1 do
		str = str .. '   ['..tostring(i)..'] = \''..self:get(i)..'\'\n';
	end
	return str;
end
-----------------------------------------------------------------------------------

function WriteToConsoleTODO(text)
    Console:Log('TODO: '..text)
end
-----------------------------------------------------------------------------------

function SaveCurrentState()
	local CurrPlayer = GetGameManager():GetCurrPlayer()
	local state = CurrPlayer.gameState
	
    if CurrPlayer and CurrPlayer.gameState then
        state:Save(GenerateSavePath(CurrPlayer.gameState:GetPath()))
    end
    ShowBlackBar("GAME_SAVED");
end
-----------------------------------------------------------------------------------

function RestorePreviousSavedState()
	local CurrPlayer = GetGameManager():GetCurrPlayer()
	local state = CurrPlayer.gameState
	
    if CurrPlayer and CurrPlayer.gameState then
        state:Load(GenerateSavePath(CurrPlayer.gameState:GetPath()))
		
		PopUpScreensMgr:DestroyAll()
		
        StartGame(state:HasState(LAST_VISITED_SCENE, CE_TAG_NAME) and CE_TAG_NAME or nil)
    end
end
-----------------------------------------------------------------------------------

function ReloadCurrentLevel()
	levelPath = GetCurrentLevel() and GetCurrentLevel().name
    
    if levelPath then
		PopUpScreensMgr:DestroyAll()
        StartLevel(levelPath)
    end
end
-----------------------------------------------------------------------------------

if not original_lua_functions then
     original_lua_functions = {}
end

original_lua_functions.assert = assert

if not verify then
    verify = function(condition)
                Log("Assertion has been failed")
                original_lua_functions.assert(condition)
             end
end

if IsDebugMode ~= nil and not IsDebugMode() then
     assert = function()
              end
end
-----------------------------------------------------------------------------------