From 0aed18911e27b80a4dbe1a252f9485382a4073c7 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 13 Apr 2025 03:37:01 +0200 Subject: Handle formatted string in log --- src/comet.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/comet.c') diff --git a/src/comet.c b/src/comet.c index 70c25ff..e8dc5e5 100644 --- a/src/comet.c +++ b/src/comet.c @@ -78,18 +78,10 @@ int main(int argc, char **argv) lua_api_t lua; lua_api_init(&lua); - - char *str = - "function sigma()\n" - " log.info('ssussy')\n" - " log.panic('az')\n" - "end\n" - "sigma()\n"; - - - (void)luaL_dostring(lua.state, "log.info('%d%n%x')"); - (void)luaL_dostring(lua.state, str); - (void)luaL_dofile(lua.state, "example.lua"); + if (luaL_dofile(lua.state, "example.lua") != LUA_OK) { + const char *error_message = lua_tostring(lua.state, -1); + log_error("Lua script failed: %s", error_message); + } const char *config_path = "comet.conf"; FILE *config_file = fopen(config_path, "rb"); -- cgit v1.2.3