about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/lcurseslib.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lcurseslib.c b/src/lcurseslib.c
index 1c38258..4704003 100644
--- a/src/lcurseslib.c
+++ b/src/lcurseslib.c
@@ -75,6 +75,16 @@ static lua_Integer checkinteger (lua_State *L, int narg, const char *expected) {
 }
 
 
+static chtype checkch (lua_State *L, int narg) {
+  if (lua_isnumber(L, narg))
+    return cast(chtype, checkinteger(L, narg, "int"));
+  if (lua_isstring(L, narg))
+    return *lua_tostring(L, narg);
+
+  return argtypeerror(L, narg, "int or char");
+}
+
+
 static int optint (lua_State *L, int narg, lua_Integer def) {
   if (lua_isnoneornil(L, narg))
     return cast(int, def);
@@ -145,6 +155,27 @@ static int Wgetmaxyx (lua_State *L) {
 }
 
 
+static int Wmvaddch (lua_State *L) {
+  WINDOW *w = checkwin(L, 1);
+  int y = checkinteger(L, 2, "int");
+  int x = checkinteger(L, 3, "int");
+  chtype ch = checkch(L, 4);
+  mvwaddch(w, y, x, ch);
+  return 1;
+}
+
+
+static int Wmvaddstr (lua_State *L) {
+  WINDOW *w = checkwin(L, 1);
+  int y = checkinteger(L, 2, "int");
+  int x = checkinteger(L, 3, "int");
+  const char *str = luaL_checkstring(L, 4);
+  int n = optint(L, 5, -1);
+  mvwaddnstr(w, y, x, str, n);
+  return 1;
+}
+
+
 static const luaL_Reg curses_window_methods[] =
 {
   {"__tostring", W__tostring},
@@ -154,6 +185,8 @@ static const luaL_Reg curses_window_methods[] =
   {"clear", Wclear},
   {"getmaxyx", Wgetmaxyx},
   {"getyx", Wgetyx},
+  {"mvaddch", Wmvaddch},
+  {"mvaddstr", Wmvaddstr},
   {NULL, NULL}
 };
 
mu/commit/html/subx/055stream.subx.html?h=main&id=6e181e7fd998a0d542cb531c929c905a243ea2f6'>6e181e7f ^
60338448 ^
ce2c1efc ^
dc5a0acf ^
d3a9db3a ^
dc5a0acf ^


6e181e7f ^















ce2c1efc ^
6e181e7f ^















762107fd ^
6e181e7f ^



2104d1a7 ^

9a777801 ^
6e181e7f ^

9a777801 ^
6e181e7f ^
3350c34a ^


































































6e181e7f ^



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140