Exemplo n.º 1
0
        /// <summary>
        /// Add a var to the collection.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="initialValue"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public ScriptVar <T> Add <T>(string name, T initialValue, T defaultValue)
        {
            var var = new ScriptVar <T>(name, initialValue, defaultValue);

            Add(name, var);
            return(var);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the value of a script var attached to this thread.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool SetVar <T>(string name, T value)
        {
            ScriptVar <T> var = vars.Get <T>(name);

            if (var != null && !var.ReadOnly)
            {
                var.Value = value;
                return(true);
            }

            return(false);
        }