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(); }
private void OnLuaChanged(LuaWatchItem luaWatchItem, Lua.Result newResult) { if (string.Equals(luaWatchItem.LuaExpression, this.luaExpression) && (questChangedHandler != null)) { questChangedHandler(title, StringToState(newResult.AsString)); } }
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; } }
private string GetLuaResultString(Lua.Result result) { if (!result.HasReturnValue) return "(no return value)"; return result.IsTable ? FormatTableResult(result) : result.AsString; }