From 1041432d06eb382f22e525cf3de2ef9c26093e76 Mon Sep 17 00:00:00 2001 From: cynic Date: Thu, 27 Oct 2022 16:28:28 -0400 Subject: [PATCH] have `w` pass up the written content --- lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib.py b/lib.py index 4fd5b77..8a6685b 100644 --- a/lib.py +++ b/lib.py @@ -68,9 +68,10 @@ def execute(program): elif ctx[0] == _ident("miracle"): return _box(getattr(eval(_destr(subs[1])), _destr(subs[2]))(*[(i if type(i) == type([]) else i[1]) for i in _fixarr(subs[3])])) elif ctx[0] == _ident("r"): - return open(_destr(subs[1]), "r").read(subs[2][1]) + return ("string", open(_destr(subs[1]), "r").read(subs[2][1])) elif ctx[0] == _ident("w"): - return open(_destr(subs[1]), "w").write(_destr(subs[2])) + open(_destr(subs[1]), "w").write(_destr(subs[2])) + return subs[2] elif ctx[0] == _ident("def"): ids[ctx[1]] = subs[2] return ids[ctx[1]]