--------------------------------- -- LuaTerm v2.0 by Jim Bauwens -- --------------------------------- -- save the real print realprint = print ------------------ -- Include libs -- ------------------ --include "tools.lua" --include "font.lua" --include "console.lua" --include "session.lua" --include "luaterm.lua" ------------------- -- General setup -- ------------------- -- init font m_font_init() -- create console local myConsole = Console() myConsole:fit(320, 240) -- create the terminal session local luaTermSession = Session(myConsole, luaTerm, nil, luaTermCommandTable) Session.addSession(luaTermSession) -- start the timer timer.start(0.01) ---------------------- -- Link with events -- ---------------------- function on.resize() --if platform.hw() ~= 3 then myConsole:fit() --end end function on.timer() Session.updateSessions() end function on.paint(gc) myConsole:draw(gc) end function on.charIn(ch) myConsole:dataIn(ch) end function on.enterKey() myConsole:dataIn("\n") end function on.backspaceKey() myConsole:dataIn("^DEL^") end function on.clearKey() myConsole:dataIn("^CLEAR^") end function on.arrowLeft() myConsole:dataIn("^CB^") end function on.arrowRight() myConsole:dataIn("^CF^") end function on.arrowUp() luaTermSession:sendCommand("history", -1) end function on.arrowDown() luaTermSession:sendCommand("history", 1) end --------------------------------------- -- Launch LuaTerm session -- --------------------------------------- luaTermSession:start()