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