Provides the function context to use when executing Mod Script scripts.
This provides some methods for changing the state of the script execution context. This includes tracking variable values, and files that should not be installed. All values in Mod Script are strings. Thus, all parameters to the functions are strings. If they represent another datatype, the functions must convert the values before using them. There are a few exceptions, where some methods accept non-string parameters. This is becuase these methods are called by the interpreter, and not from the interpreted code.
コード例 #1
0
		/// <summary>
		/// A simple construtor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_msfFunctions">The object that implements the script functions.</param>
		/// <param name="p_strScript">The script to execute.</param>
		public ModScriptInterpreter(ModScriptFunctionProxy p_msfFunctions, string p_strScript)
		{
			m_strScript = p_strScript;
			Regex rgxAllowRunOnLines = new Regex(@"^\s*AllowRunOnLines\s*$", RegexOptions.Multiline);
			if (rgxAllowRunOnLines.IsMatch(m_strScript))
			{
				m_strScript = rgxAllowRunOnLines.Replace(m_strScript, "");
				Regex rgxContinuedLines = new Regex(@"\\\s*\n", RegexOptions.Multiline);
				m_strScript = rgxContinuedLines.Replace(m_strScript, "");
			}
			m_sicContext = CreateInterpreterContext(p_msfFunctions);
		}
コード例 #2
0
        /// <summary>
        /// A simple construtor that initializes the object with the given values.
        /// </summary>
        /// <param name="p_msfFunctions">The object that implements the script functions.</param>
        /// <param name="p_strScript">The script to execute.</param>
        public ModScriptInterpreter(ModScriptFunctionProxy p_msfFunctions, string p_strScript)
        {
            m_strScript = p_strScript;
            Regex rgxAllowRunOnLines = new Regex(@"^\s*AllowRunOnLines\s*$", RegexOptions.Multiline);

            if (rgxAllowRunOnLines.IsMatch(m_strScript))
            {
                m_strScript = rgxAllowRunOnLines.Replace(m_strScript, "");
                Regex rgxContinuedLines = new Regex(@"\\\s*\n", RegexOptions.Multiline);
                m_strScript = rgxContinuedLines.Replace(m_strScript, "");
            }
            m_sicContext = CreateInterpreterContext(p_msfFunctions);
        }