mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Added the ability to use lists and dictionaries without indices to obtain their string representation (e.g. typing <LIST123> will print [a,b]).
This commit is contained in:
@@ -211,6 +211,14 @@ namespace RuriLib
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CVar.VarType.List:
|
case CVar.VarType.List:
|
||||||
|
|
||||||
|
// If it's just the list name, replace it with its string representation
|
||||||
|
if (string.IsNullOrEmpty(args))
|
||||||
|
{
|
||||||
|
output = output.Replace(full, v.ToString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
int.TryParse(ParseArguments(args, '[', ']')[0], out index);
|
int.TryParse(ParseArguments(args, '[', ']')[0], out index);
|
||||||
var item = v.GetListItem(index); // Can return null
|
var item = v.GetListItem(index); // Can return null
|
||||||
@@ -218,6 +226,7 @@ namespace RuriLib
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CVar.VarType.Dictionary:
|
case CVar.VarType.Dictionary:
|
||||||
|
|
||||||
if (args.Contains("(") && args.Contains(")"))
|
if (args.Contains("(") && args.Contains(")"))
|
||||||
{
|
{
|
||||||
var dicKey = ParseArguments(args, '(', ')')[0];
|
var dicKey = ParseArguments(args, '(', ')')[0];
|
||||||
@@ -228,6 +237,11 @@ namespace RuriLib
|
|||||||
var dicVal = ParseArguments(args, '{', '}')[0];
|
var dicVal = ParseArguments(args, '{', '}')[0];
|
||||||
try { output = output.Replace(full, v.GetDictKey(dicVal)); } catch { }
|
try { output = output.Replace(full, v.GetDictKey(dicVal)); } catch { }
|
||||||
}
|
}
|
||||||
|
else // If it's just the dictionary name, replace it with its string representation
|
||||||
|
{
|
||||||
|
output = output.Replace(full, v.ToString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user