示例#1
0
        /// <summary>
        /// Gets a table within this table.
        /// </summary>
        /// <param name="name">Name of the table</param>
        /// <returns></returns>
        public ScriptTable GetTable(string name)
        {
            var scriptPtr = NativeScriptTableMethods.GetSubScriptTable(Handle, name);

            if (scriptPtr != IntPtr.Zero)
            {
                var scriptTable = ScriptTables.FirstOrDefault(x => x.Handle == scriptPtr);
                if (scriptTable != default(ScriptTable))
                {
                    return(scriptTable);
                }

                scriptTable = new ScriptTable(scriptPtr);
                ScriptTables.Add(scriptTable);
                return(scriptTable);
            }

            return(null);
        }
示例#2
0
        internal static ScriptTable Get(IntPtr entityPtr)
        {
            if (ScriptTables == null)
            {
                ScriptTables = new List <ScriptTable>();
            }

            var scriptPtr = NativeScriptTableMethods.GetScriptTable(entityPtr);

            if (scriptPtr != IntPtr.Zero)
            {
                var scriptTable = ScriptTables.FirstOrDefault(x => x.Handle == scriptPtr);
                if (scriptTable != default(ScriptTable))
                {
                    return(scriptTable);
                }

                scriptTable = new ScriptTable(scriptPtr);
                ScriptTables.Add(scriptTable);
                return(scriptTable);
            }

            return(null);
        }
示例#3
0
 public void SetValue(string name, object value)
 {
     NativeScriptTableMethods.SetValue(Handle, name, value);
 }
示例#4
0
 /// <summary>
 /// Gets a value within the table.
 /// </summary>
 /// <param name="name">Name of the value</param>
 /// <returns>The value or null</returns>
 public object GetValue(string name)
 {
     return(NativeScriptTableMethods.GetValue(Handle, name));
 }
示例#5
0
 /// <summary>
 /// Invokes a method on the script table
 /// </summary>
 /// <param name="methodName">Name of the method</param>
 /// <param name="args">Invocation arguments</param>
 /// <returns>Result or null</returns>
 public object CallMethod(string methodName, params object[] args)
 {
     return(NativeScriptTableMethods.CallMethod(Handle, methodName, args));
 }
示例#6
0
 /// <summary>
 /// Global lua script execution
 /// </summary>
 /// <param name="buffer"></param>
 /// <returns>False if execution fails, otherwise true.</returns>
 public static bool Execute(string buffer)
 {
     return(NativeScriptTableMethods.ExecuteBuffer(buffer));
 }