an experimental irc client

lua: properly pop table fields off the stack

We weren't popping fields off the stack, so when we reffed the config
table we actually were referencing something else. The config table
would get garbage collected, causing issues on reconnect.

+9 -4
+9 -4
src/lua.zig
··· 283 283 // [table] 284 284 var lua_type = lua.getField(1, "user"); // [table,string] 285 285 lua.argCheck(lua_type == .string, 1, "expected a string for field 'user'"); 286 - const user = lua.toString(-1) catch unreachable; // [table] 286 + const user = lua.toString(-1) catch unreachable; 287 + lua.pop(1); // [table] 287 288 288 289 lua_type = lua.getField(1, "nick"); // [table,string] 289 290 lua.argCheck(lua_type == .string, 1, "expected a string for field 'nick'"); 290 - const nick = lua.toString(-1) catch unreachable; // [table] 291 + const nick = lua.toString(-1) catch unreachable; 292 + lua.pop(1); // [table] 291 293 292 294 lua_type = lua.getField(1, "password"); // [table, string] 293 295 lua.argCheck(lua_type == .string, 1, "expected a string for field 'password'"); 294 - const password = lua.toString(-1) catch unreachable; // [table] 296 + const password = lua.toString(-1) catch unreachable; 297 + lua.pop(1); // [table] 295 298 296 299 lua_type = lua.getField(1, "real_name"); // [table, string] 297 300 lua.argCheck(lua_type == .string, 1, "expected a string for field 'real_name'"); 298 - const real_name = lua.toString(-1) catch unreachable; // [table] 301 + const real_name = lua.toString(-1) catch unreachable; 302 + lua.pop(1); // [table] 299 303 300 304 lua_type = lua.getField(1, "server"); // [table, string] 301 305 lua.argCheck(lua_type == .string, 1, "expected a string for field 'server'"); 302 306 const server = lua.toString(-1) catch unreachable; // [table] 307 + lua.pop(1); // [table] 303 308 304 309 lua_type = lua.getField(1, "tls"); // [table, boolean|nil] 305 310 const tls: bool = switch (lua_type) {