mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
replace require with dofile, rename Hotkeys to Keyboard
This commit is contained in:
@@ -44,3 +44,20 @@ end
|
||||
function quit()
|
||||
exit()
|
||||
end
|
||||
|
||||
function reloadModule(name)
|
||||
local module = g_modules.getModule(name)
|
||||
if module then
|
||||
module:unload()
|
||||
module:load()
|
||||
end
|
||||
end
|
||||
|
||||
function autoReloadModule(name)
|
||||
local function reloadEvent()
|
||||
reloadModule(name)
|
||||
scheduleEvent(reloadEvent, 1000)
|
||||
end
|
||||
reloadEvent()
|
||||
end
|
||||
|
||||
|
@@ -108,15 +108,15 @@ function Terminal.init()
|
||||
terminalWidget:setVisible(false)
|
||||
|
||||
terminalButton = TopMenu.addButton('terminalButton', 'Terminal (Ctrl + T)', 'terminal.png', Terminal.toggle)
|
||||
Hotkeys.bindKeyDown('Ctrl+T', Terminal.toggle)
|
||||
Keyboard.bindKeyDown('Ctrl+T', Terminal.toggle)
|
||||
|
||||
commandHistory = Settings.getList('terminal-history')
|
||||
|
||||
commandLineEdit = terminalWidget:getChildById('commandLineEdit')
|
||||
Hotkeys.bindKeyDown('Up', function() navigateCommand(1) end, commandLineEdit)
|
||||
Hotkeys.bindKeyDown('Down', function() navigateCommand(-1) end, commandLineEdit)
|
||||
Hotkeys.bindKeyDown('Tab', completeCommand, commandLineEdit)
|
||||
Hotkeys.bindKeyDown('Enter', doCommand, commandLineEdit)
|
||||
Keyboard.bindKeyDown('Up', function() navigateCommand(1) end, commandLineEdit)
|
||||
Keyboard.bindKeyDown('Down', function() navigateCommand(-1) end, commandLineEdit)
|
||||
Keyboard.bindKeyDown('Tab', completeCommand, commandLineEdit)
|
||||
Keyboard.bindKeyDown('Enter', doCommand, commandLineEdit)
|
||||
|
||||
terminalBuffer = terminalWidget:getChildById('terminalBuffer')
|
||||
Logger.setOnLog(onLog)
|
||||
@@ -125,7 +125,7 @@ end
|
||||
|
||||
function Terminal.terminate()
|
||||
Settings.setList('terminal-history', commandHistory)
|
||||
Hotkeys.unbindKeyDown('Ctrl+T')
|
||||
Keyboard.unbindKeyDown('Ctrl+T')
|
||||
Logger.setOnLog(nil)
|
||||
terminalButton:destroy()
|
||||
terminalButton = nil
|
||||
|
@@ -8,8 +8,8 @@ Module
|
||||
autoLoadAntecedence: 200
|
||||
|
||||
onLoad: |
|
||||
require 'terminal'
|
||||
require 'commands'
|
||||
dofile 'terminal'
|
||||
dofile 'commands'
|
||||
Terminal.init()
|
||||
|
||||
onUnload: |
|
||||
|
Reference in New Issue
Block a user