about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lua.c b/src/lua.c
index 337341d..8796ca7 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -5,6 +5,7 @@
 */
 
 
+#include <assert.h>
 #include <fcntl.h>
 #include <locale.h>
 #include <ncurses.h>
@@ -305,7 +306,7 @@ static int handle_image (lua_State *L, char **argv, int n) {
 
 const char *Current_definition = NULL;
 void save_to_current_definition_and_editor_buffer (lua_State *L, const char *definition) {
-    Current_definition = definition;
+    Current_definition = strdup(definition);
     lua_getglobal(L, "teliva_program");
     lua_getfield(L, -1, Current_definition);
     const char *contents = lua_tostring(L, -1);
@@ -327,6 +328,7 @@ static void read_contents (lua_State *L, char *filename, char *out) {
 /* table to update is at top of stack */
 static void update_definition (lua_State *L, const char *name, char *out) {
     lua_pushstring(L, out);
+    assert(strlen(name) > 0);
     lua_setfield(L, -2, name);
 }
 
e the previous revision' href='/akkartik/mu/blame/html/059to_text.mu.html?h=hlt&id=848ebc1e6335cd1a34e07662242a367fefbc5229'>^
e5c11a51 ^
9e751bb8 ^
0ca56ed8 ^
4a39d12d ^
0ca56ed8 ^
e5c11a51 ^
0ca56ed8 ^





e5c11a51 ^






















0ca56ed8 ^


e5c11a51 ^
0ca56ed8 ^
87c5b329 ^
204dae92 ^


87c5b329 ^
204dae92 ^









201458e3 ^
204dae92 ^











201458e3 ^
204dae92 ^















9e751bb8 ^
204dae92 ^

0ca56ed8 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111