private LuaTable ReadLuaTable(EndianBinaryReader reader, int pointerSize)
        {
            LuaTable table = new LuaTable();
            int      count = reader.ReadUInt16();

            for (int i = 0; i < count; ++i)
            {
                ILuaAnyValue key   = ReadLuaAnyValue(reader, pointerSize);
                ILuaAnyValue value = ReadLuaAnyValue(reader, pointerSize);
                if (!table.Value.ContainsKey(key))
                {
                    table.Value[key] = value;
                }
            }
            return(table);
        }
Exemple #2
0
 private void newEditor_OnHoverOverVariable(object sender, HoverVariableEventArgs e)
 {
     if (string.IsNullOrEmpty(e.VariableName))
     {
         ClearToolTip();
     }
     else
     {
         ILuaAnyValue value = GetVariable(e.VariableName);
         if (value != LuaNil.Instance)
         {
             string toolTipText = string.Format("{0} : {1}", e.VariableName, value.ToString());
             Point  toolTipPos  = tabControlSourceFiles.PointToClient(e.HoverScreenLocation);
             toolTip.Show(toolTipText, tabControlSourceFiles, toolTipPos);
         }
         else
         {
             toolTip.Hide(tabControlSourceFiles);
         }
     }
 }
Exemple #3
0
        private ILuaAnyValue GetVariable(string variableName)
        {
            string[] parts     = variableName.Split('.');
            LuaTable rootTable = luaVariablesModel.RootLuaTable;
            IEnumerable <LuaTable> tablesToSearch = new LuaTable[] { rootTable };

            if (debugger.HostVersion >= 7)
            {
                if (rootTable != null)
                {
                    tablesToSearch = rootTable.Value.Values.OfType <LuaTable>();
                }
            }
            foreach (LuaTable hayStack in tablesToSearch)
            {
                ILuaAnyValue result = hayStack;
                foreach (string part in parts)
                {
                    LuaTable table = result as LuaTable;
                    if (table != null)
                    {
                        if (table.Value.TryGetValue(new LuaString(part), out result))
                        {
                            continue;
                        }
                    }
                    result = null;
                    break;
                }
                if (result != null)
                {
                    return(result);
                }
            }
            return(LuaNil.Instance);
        }
Exemple #4
0
 public LuaWatchVariable(string _name, ILuaAnyValue _value)
 {
     name  = _name;
     value = _value;
 }
Exemple #5
0
 public LuaVariableItem(ILuaAnyValue _key, ILuaAnyValue _value)
 {
     key   = _key;
     value = _value;
 }