diff options
| author | Federico Angelilli <code@fedang.net> | 2025-04-13 03:37:01 +0200 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2025-04-13 03:37:01 +0200 |
| commit | 0aed18911e27b80a4dbe1a252f9485382a4073c7 (patch) | |
| tree | 5bdc87cb223c7f812a672bda88be1fd2020b1516 /src/comet.c | |
| parent | 91149e6c41a094bf29ed6a1aa00c0fa6c1015a24 (diff) | |
Handle formatted string in log
Diffstat (limited to 'src/comet.c')
| -rw-r--r-- | src/comet.c | 16 |
1 files changed, 4 insertions, 12 deletions
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"); |
