about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/lua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lua.c b/src/lua.c
index 7da0f02..a0ca094 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -337,6 +337,7 @@ void editString(lua_State *L, char *name) {
     teliva_get_definition(L, name);
 //?     stackDump(L);
     const char *contents = lua_tostring(L, -1);
+    lua_pop(L, 1);
     int outfd = open("teliva_editbuffer", O_WRONLY|O_CREAT|O_TRUNC, 0644);
     write(outfd, contents, strlen(contents));
     close(outfd);
@@ -351,7 +352,6 @@ void editString(lua_State *L, char *name) {
     close(infd);
 
     /* save contents back into image */
-    lua_pop(L, 1);
     lua_pushstring(L, new_contents);
     lua_setfield(L, -2, name);