local function start() print("Chat program started.") end local function stop() print("Chat program stopped.") end local function restart() stop() start() end local function main() print("Chat main loop running...") while true do local event = os.pullEvent() -- Chat logic here if event == "char" then print("Char typed") end end end return { start = start, stop = stop, restart = restart, main = main }