Esempio n. 1
0
	ErrCode LuaEngine::VExecuteExpression(const UString& expression)
	{
		ErrCode error = ErrCode::ERR_SUCCESS;

		if (expression.empty()) {
			DebugPrintF(VTEXT("SCRIPT EMPTY"));
			return ErrCode::ERR_NULL_PATH;
		}

        std::string _exp = UStringToStd(expression);
		int state = luaL_dostring(m_L, _exp.c_str());
		error = ReportScriptErrors(state);
		if (CheckError(error)) {
                        DebugPrintF(VTEXT("Failed to execute script expression"));
		}

		return error;
	}
Esempio n. 2
0
    bool LuaEngine::ExecuteExpression(UString expression)
    {
        LuaEngine& _engine = LuaEngine::instance();

        if (expression.empty()) {
            DebugPrintF(VTEXT("SCRIPT EMPTY"));
            return false;
        }

        std::string _exp = UStringToStd(expression);
        int state = luaL_dostring(_engine.m_L, _exp.c_str());
        if (!ReportScriptErrors(state)) {
            DebugPrintF(VTEXT("Failed to execute script expression"));
            return false;
        }

        return true;
    }
Esempio n. 3
0
	ErrCode LuaEngine::VExecuteFile(const UString& path)
	{
		ErrCode error = ErrCode::ERR_SUCCESS;

		if (path.empty()) {
			DebugPrintF(VTEXT("Failed to execute script file: NULL PATH"));
			return ErrCode::ERR_NULL_PATH;
		}

		/*try and execute script file*/
        std::string _path = UStringToStd(path);
		int state = luaL_dofile(m_L, _path.c_str());
		error = ReportScriptErrors(state);
		if (CheckError(error)) {
                        DebugPrintF(VTEXT("Failed to execute script file"));
		}
		return error;
	}