about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-26 19:45:19 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-26 19:45:19 -0800
commit0726692546c16c16344c8fcdc21942e999d52ea9 (patch)
treec977e06268eb38f69305995663bd8198844cda91
parent3cb37a0f3948670cfd833a5cad5a32019dfdb097 (diff)
downloadteliva-0726692546c16c16344c8fcdc21942e999d52ea9.tar.gz
more obvious serialization of undo events
-rw-r--r--src/lua.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lua.c b/src/lua.c
index 7662a55..d34b902 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -453,6 +453,10 @@ static void save_image (lua_State *L) {
     fprintf(out, "  {\n");
     for (lua_pushnil(L); lua_next(L, table) != 0; lua_pop(L, 1)) {
       const char* key = lua_tostring(L, -2);
+      if (strcmp(key, "__teliva_undo") == 0) {
+        fprintf(out, "    %s = %d\n", key, lua_tointeger(L, -1));
+        continue;
+      }
       const char* value = lua_tostring(L, -1);
       fprintf(out, "    %s = [==[\n", key);
       fprintf(out, "%s", value);