Exemplo n.º 1
0
 private string FormatTableResult(Lua.Result result)
 {
     if (!result.IsTable) return result.AsString;
     LuaTableWrapper table = result.AsTable;
     StringBuilder sb = new StringBuilder();
     sb.Append("Table:\n");
     foreach (object key in table.Keys) {
         sb.Append(string.Format("[{0}]: {1}\n", new System.Object[] { key.ToString(), table[key.ToString()].ToString() }));
     }
     return sb.ToString();
 }
Exemplo n.º 2
0
 private void OnLuaChanged(LuaWatchItem luaWatchItem, Lua.Result newResult)
 {
     if (string.Equals(luaWatchItem.LuaExpression, this.luaExpression) && (questChangedHandler != null)) {
         questChangedHandler(title, StringToState(newResult.AsString));
     }
 }
Exemplo n.º 3
0
 private object CastLuaResult(SharedVariableTypes variableType, Lua.Result result)
 {
     switch (variableType) {
     case SharedVariableTypes.Bool:
         return result.AsBool;
     case SharedVariableTypes.Float:
         return result.AsFloat;
     case SharedVariableTypes.Int:
         return result.AsInt;
     case SharedVariableTypes.String:
         return result.AsString;
     default:
         return null;
     }
 }
Exemplo n.º 4
0
 private string GetLuaResultString(Lua.Result result)
 {
     if (!result.HasReturnValue) return "(no return value)";
     return result.IsTable ? FormatTableResult(result) : result.AsString;
 }