Pass listening port to lua when calling oct_init

This commit is contained in:
j4nk 2025-03-16 22:05:09 -04:00
parent 59932d224f
commit 7cf075d1a6
2 changed files with 4 additions and 2 deletions

3
main.c
View File

@ -214,7 +214,8 @@ int initialize_everything(char* lua_file) {
OCT_LOG_INFO("Begin running oct_init()");
lua_getglobal(L, "oct_init");
lua_pushstring(L, lua_args);
if (lua_pcall(L, 1, 2, 0) != LUA_OK) {
lua_pushinteger(L, atoi(config.port));
if (lua_pcall(L, 2, 2, 0) != LUA_OK) {
OCT_LOG_ERROR("%s", luaL_checkstring(L, -1));
deinitialize_everything();
return 0;

View File

@ -1,8 +1,9 @@
require("oct_utils")
require("termbox_defs")
function oct_init(args)
function oct_init(args, port)
OCT_LOG_ERROR("Starting oct_init")
OCT_LOG_ERROR("Port: " .. port)
OCT_LOG_ERROR("Received args: " .. args)
return OCT_NOT_NEEDS_NETWORKING, OCT_NOT_NEEDS_TERMBOX
end