replace require with dofile, rename Hotkeys to Keyboard

master
Eduardo Bart преди 12 години
родител 64c9e4f1d5
ревизия f97104f12e

@ -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: |

@ -34,4 +34,5 @@ function Client.terminate()
Settings.set('window-size', g_window.getUnmaximizedSize())
Settings.set('window-pos', g_window.getUnmaximizedPos())
Settings.set('window-maximized', g_window.isMaximized())
g_window.hide()
end

@ -3,6 +3,7 @@ Module
description: Load all other otclient dependecies
author: OTClient team
website: https://github.com/edubart/otclient
canUnload: false
// NOTE: order does matter
dependencies:
@ -16,7 +17,7 @@ Module
- game
onLoad: |
require 'client'
dofile 'client'
Client.init()
onUnload: |

@ -5,7 +5,7 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'about'
dofile 'about'
About.init()
onUnload: |

@ -5,7 +5,7 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'background'
dofile 'background'
Background.init()
onUnload: |

@ -57,7 +57,7 @@ end
-- public functions
function EnterGame.init()
enterGameButton = TopMenu.addButton('enterGameButton', 'Login (Ctrl + G)', '/core_styles/icons/login.png', EnterGame.openWindow)
Hotkeys.bindKeyDown('Ctrl+G', EnterGame.openWindow)
Keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)
motdButton = TopMenu.addButton('motdButton', 'Message of the day', '/core_styles/icons/motd.png', EnterGame.displayMotd)
motdButton:hide()
enterGame = displayUI('entergame.otui')
@ -82,7 +82,7 @@ function EnterGame.init()
end
function EnterGame.terminate()
Hotkeys.unbindKeyDown('Ctrl+G')
Keyboard.unbindKeyDown('Ctrl+G')
enterGame:destroy()
enterGame = nil
enterGameButton:destroy()

@ -5,8 +5,8 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'entergame'
require 'characterlist'
dofile 'entergame'
dofile 'characterlist'
EnterGame.init()
onUnload: |

@ -4,7 +4,7 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'modulemanager'
dofile 'modulemanager'
ModuleManager.init()
onUnload: |

@ -25,11 +25,11 @@ function Options.init()
optionsWindow = displayUI('options.otui')
optionsWindow:setVisible(false)
optionsButton = TopMenu.addButton('optionsButton', 'Options (Ctrl+O)', 'options.png', Options.toggle)
Hotkeys.bindKeyDown('Ctrl+O', Options.toggle)
Keyboard.bindKeyDown('Ctrl+O', Options.toggle)
end
function Options.terminate()
Hotkeys.unbindKeyDown('Ctrl+O')
Keyboard.unbindKeyDown('Ctrl+O')
optionsWindow:destroy()
optionsWindow = nil
optionsButton:destroy()

@ -5,7 +5,7 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'options'
dofile 'options'
Options.init()
onUnload: |

@ -23,11 +23,11 @@ function TopMenu.init()
gameButtonsPanel = topMenu:getChildById('gameButtonsPanel')
TopMenu.addRightButton('logoutButton', 'Logout (Ctrl+Q)', '/core_styles/icons/logout.png', onLogout)
Hotkeys.bindKeyDown('Ctrl+Q', onLogout)
Keyboard.bindKeyDown('Ctrl+Q', onLogout)
end
function TopMenu.terminate()
Hotkeys.unbindKeyDown('Ctrl+Q')
Keyboard.unbindKeyDown('Ctrl+Q')
leftButtonsPanel = nil
rightButtonsPanel = nil
gameButtonsPanel = nil
@ -71,16 +71,6 @@ function TopMenu.addRightButton(id, description, icon, callback)
return TopMenu.addButton(id, description, resolvepath(icon, 2), callback, true)
end
function TopMenu.removeButton(param)
local button
if type(param) == 'string' then
button = TopMenu.getButton(param)
else
button = param
end
button:destroy()
end
function TopMenu.hideGameButtons()
gameButtonsPanel:hide()
end
@ -93,10 +83,5 @@ function TopMenu.getButton(id)
return topMenu:recursiveGetChildById(id)
end
function TopMenu:getLogoutButton(id)
return TopMenu.getButton('logoutButton')
end
connect(Game, { onLogin = TopMenu.showGameButtons,
onLogout = TopMenu.hideGameButtons})
onLogout = TopMenu.hideGameButtons })

@ -5,7 +5,7 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'topmenu'
dofile 'topmenu'
TopMenu.init()
onUnload: |

@ -3,6 +3,8 @@ Module
description: Contains fonts used by core
author: OTClient team
website: https://github.com/edubart/otclient
canUnload: false
onLoad: |
importFont 'verdana-11px-antialised'
importFont 'verdana-11px-monochrome'

@ -5,21 +5,21 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'ext/table'
require 'ext/string'
require 'ext/os'
require 'math/point'
require 'math/size'
require 'math/color'
require 'math/rect'
require 'const'
require 'util'
require 'globals'
require 'dispatcher'
require 'effects'
require 'settings'
require 'hotkeys'
require 'cursor'
dofile 'ext/table'
dofile 'ext/string'
dofile 'ext/os'
dofile 'math/point'
dofile 'math/size'
dofile 'math/color'
dofile 'math/rect'
dofile 'const'
dofile 'util'
dofile 'globals'
dofile 'dispatcher'
dofile 'effects'
dofile 'settings'
dofile 'keyboard'
dofile 'mouse'
onUnload: |
rootWidget = nil

@ -1,7 +0,0 @@
function setTargetCursor()
g_window.setMouseCursor('/core_styles/icons/targetcursor.png', {x=9,y=9})
end
function restoreCursor()
g_window.restoreMouseCursor()
end

@ -0,0 +1,134 @@
Keyboard = {}
-- private functions
local function translateKeyCombo(keyCombo)
if not keyCombo or #keyCombo == 0 then return nil end
table.sort(keyCombo)
local keyComboDesc = ''
for k,v in pairs(keyCombo) do
local keyDesc = KeyCodeDescs[v]
if keyDesc == nil then return nil end
keyComboDesc = keyComboDesc .. '+' .. keyDesc
end
keyComboDesc = keyComboDesc:sub(2)
return keyComboDesc
end
local function retranslateKeyComboDesc(keyComboDesc)
if keyComboDesc == nil then return nil end
local keyCombo = {}
for i,currentKeyDesc in ipairs(keyComboDesc:split('+')) do
for keyCode, keyDesc in pairs(KeyCodeDescs) do
if keyDesc:lower() == currentKeyDesc:trim():lower() then
table.insert(keyCombo, keyCode)
end
end
end
return translateKeyCombo(keyCombo)
end
local function determineKeyComboDesc(keyCode, keyboardModifiers)
local keyCombo = {}
if keyCode == KeyCtrl or keyCode == KeyShift or keyCode == KeyAlt then
table.insert(keyCombo, keyCode)
elseif KeyCodeDescs[keyCode] ~= nil then
if keyboardModifiers == KeyboardCtrlModifier then
table.insert(keyCombo, KeyCtrl)
elseif keyboardModifiers == KeyboardAltModifier then
table.insert(keyCombo, KeyAlt)
elseif keyboardModifiers == KeyboardCtrlAltModifier then
table.insert(keyCombo, KeyCtrl)
table.insert(keyCombo, KeyAlt)
elseif keyboardModifiers == KeyboardShiftModifier then
table.insert(keyCombo, KeyShift)
elseif keyboardModifiers == KeyboardCtrlShiftModifier then
table.insert(keyCombo, KeyCtrl)
table.insert(keyCombo, KeyShift)
elseif keyboardModifiers == KeyboardAltShiftModifier then
table.insert(keyCombo, KeyAlt)
table.insert(keyCombo, KeyShift)
elseif keyboardModifiers == KeyboardCtrlAltShiftModifier then
table.insert(keyCombo, KeyCtrl)
table.insert(keyCombo, KeyAlt)
table.insert(keyCombo, KeyShift)
end
table.insert(keyCombo, keyCode)
end
table.sort(keyCombo)
return translateKeyCombo(keyCombo)
end
local function onWidgetKeyDown(widget, keyCode, keyboardModifiers)
if keyCode == KeyUnknown then return end
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
local callback = widget.boundKeyDownCombos[keyComboDesc]
if callback then
callback()
return true
end
return false
end
local function onWidgetKeyPress(widget, keyCode, keyboardModifiers, wouldFilter)
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
if keyCode == KeyUnknown then return end
local callback = widget.boundKeyPressCombos[keyComboDesc]
if callback then
callback()
return true
end
return false
end
local function connectKeyDownEvent(widget)
if widget.boundKeyDownCombos then return end
connect(widget, { onKeyDown = onWidgetKeyDown })
widget.boundKeyDownCombos = {}
end
local function connectKeyPressEvent(widget)
if widget.boundKeyPressCombos then return end
connect(widget, { onKeyPress = onWidgetKeyPress })
widget.boundKeyPressCombos = {}
end
-- public functions
function Keyboard.bindKeyDown(keyComboDesc, callback, widget)
widget = widget or rootWidget
connectKeyDownEvent(widget)
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
if keyComboDesc then
widget.boundKeyDownCombos[keyComboDesc] = callback
else
error('key combo \'' .. keyComboDesc .. '\' is failed')
end
end
function Keyboard.bindKeyPress(keyComboDesc, callback, widget)
widget = widget or rootWidget
connectKeyPressEvent(widget)
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
if keyComboDesc then
widget.boundKeyPressCombos[keyComboDesc] = callback
else
error('key combo \'' .. keyComboDesc .. '\' is failed')
end
end
function Keyboard.unbindKeyDown(keyComboDesc, widget)
widget = widget or rootWidget
if widget.boundKeyDownCombos == nil then return end
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
if keyComboDesc then
widget.boundKeyDownCombos[keyComboDesc] = nil
end
end
function Keyboard.unbindKeyPress(keyComboDesc, widget)
widget = widget or rootWidget
if widget.boundKeyPressCombos == nil then return end
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
if keyComboDesc then
widget.boundKeyPressCombos[keyComboDesc] = nil
end
end

@ -1,2 +1,9 @@
Mouse = {}
function Mouse.setTargetCursor()
g_window.setMouseCursor('/core_styles/icons/targetcursor.png', {x=9,y=9})
end
function Mouse.restoreCursor()
g_window.restoreMouseCursor()
end

@ -114,7 +114,3 @@ function signalcall(param, ...)
end
return false
end
function runscript(file)
g_lua.runScript(resolvepath(file, 2))
end

@ -5,17 +5,17 @@ Module
website: https://github.com/edubart/otclient
onLoad: |
require 'uiwidget'
require 'uibutton'
require 'uilabel'
require 'uicheckbox'
require 'uicombobox'
require 'uispinbox'
require 'uiprogressbar'
require 'uitabbar'
require 'uipopupmenu'
require 'uiwindow'
require 'uiitem'
require 'tooltip/tooltip'
require 'messagebox/messagebox'
dofile 'uiwidget'
dofile 'uibutton'
dofile 'uilabel'
dofile 'uicheckbox'
dofile 'uicombobox'
dofile 'uispinbox'
dofile 'uiprogressbar'
dofile 'uitabbar'
dofile 'uipopupmenu'
dofile 'uiwindow'
dofile 'uiitem'
dofile 'tooltip/tooltip'
dofile 'messagebox/messagebox'

@ -8,7 +8,7 @@ function UIItem:onDragEnter(mousePos)
self.parsed = false
self.currentDragThing = item
setTargetCursor()
Mouse.setTargetCursor()
return true
end
@ -19,7 +19,7 @@ function UIItem:onDragLeave(widget, mousePos)
self.currentDragThing = nil
end
restoreCursor()
Mouse.restoreCursor()
self:setBorderWidth(0)
return true
end

@ -1,3 +1,4 @@
--[[
UIMessageBox = extends(UIWindow)
function UIMessageBox.create(title, message)
@ -19,5 +20,4 @@ end
function UIMessageBox:setMessage(message)
end
function
]]--

@ -32,7 +32,7 @@ local function onUseWithMouseRelease(self, mousePosition, mouseButton)
end
end
Game.selectedThing = nil
restoreCursor()
Mouse.restoreCursor()
self:ungrabMouse()
return true
end
@ -41,7 +41,7 @@ end
function Game.startUseWith(thing)
Game.selectedThing = thing
m_mouseGrabberWidget:grabMouse()
setTargetCursor()
Mouse.setTargetCursor()
end
function Game.createInterface()
@ -49,15 +49,15 @@ function Game.createInterface()
CharacterList.destroyLoadBox()
Game.gameUi = displayUI('game.otui')
--Hotkeys.bindKeyPress('Up', function() Game.walk(North) end)
--Hotkeys.bindKeyPress('Down', function() Game.walk(South) end)
--Hotkeys.bindKeyPress('Left', function() Game.walk(West) end)
--Hotkeys.bindKeyPress('Right', function() Game.walk(East) end)
--Keyboard.bindKeyPress('Up', function() Game.walk(North) end)
--Keyboard.bindKeyPress('Down', function() Game.walk(South) end)
--Keyboard.bindKeyPress('Left', function() Game.walk(West) end)
--Keyboard.bindKeyPress('Right', function() Game.walk(East) end)
Hotkeys.bindKeyPress('Ctrl+Shift+Up', function() Game.forceWalk(North) end)
Hotkeys.bindKeyPress('Ctrl+Shift+Down', function() Game.forceWalk(South) end)
Hotkeys.bindKeyPress('Ctrl+Shift+Left', function() Game.forceWalk(West) end)
Hotkeys.bindKeyPress('Ctrl+Shift+Right', function() Game.forceWalk(East) end)
Keyboard.bindKeyPress('Ctrl+Shift+Up', function() Game.forceWalk(North) end)
Keyboard.bindKeyPress('Ctrl+Shift+Down', function() Game.forceWalk(South) end)
Keyboard.bindKeyPress('Ctrl+Shift+Left', function() Game.forceWalk(West) end)
Keyboard.bindKeyPress('Ctrl+Shift+Right', function() Game.forceWalk(East) end)
rootWidget:moveChildToIndex(Game.gameUi, 1)
Game.gameMapPanel = Game.gameUi:getChildById('gameMapPanel')

@ -15,8 +15,8 @@ Module
- game_containers
onLoad: |
require 'game'
require 'thing'
require 'creature'
require 'player'
require 'map'
dofile 'game'
dofile 'thing'
dofile 'creature'
dofile 'player'
dofile 'map'

@ -7,7 +7,7 @@ function UIMap:onDragEnter(mousePos)
self.parsed = false
self.currentDragThing = thing
setTargetCursor()
Mouse.setTargetCursor()
return true
end
@ -16,7 +16,7 @@ function UIMap:onDragLeave(widget, mousePos)
self.currentDragThing = nil
end
restoreCursor()
Mouse.restoreCursor()
return true
end

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'combatcontrols'
dofile 'combatcontrols'

@ -88,11 +88,11 @@ function Console.create()
Console.addChannel('Default', 0)
Console.addTab('Server Log', false)
Hotkeys.bindKeyDown('Shift+Up', function() navigateMessageHistory(1) end, consolePanel)
Hotkeys.bindKeyDown('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel)
Hotkeys.bindKeyDown('Tab', function() consoleTabBar:selectNextTab() end, consolePanel)
Hotkeys.bindKeyDown('Shift+Tab', function() consoleTabBar:selectPrevTab() end, consolePanel)
Hotkeys.bindKeyDown('Enter', Console.sendCurrentMessage, consolePanel)
Keyboard.bindKeyDown('Shift+Up', function() navigateMessageHistory(1) end, consolePanel)
Keyboard.bindKeyDown('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel)
Keyboard.bindKeyDown('Tab', function() consoleTabBar:selectNextTab() end, consolePanel)
Keyboard.bindKeyDown('Shift+Tab', function() consoleTabBar:selectPrevTab() end, consolePanel)
Keyboard.bindKeyDown('Enter', Console.sendCurrentMessage, consolePanel)
-- apply buttom functions after loaded
connect(consolePanel:getChildById('nextChannelButton'), { onClick = function() consoleTabBar:selectNextTab() end } )
@ -100,8 +100,8 @@ function Console.create()
connect(consoleTabBar, { onTabChange = Console.onTabChange })
-- tibia like hotkeys
Hotkeys.bindKeyDown('Ctrl+O', Game.requestChannels)
Hotkeys.bindKeyDown('Ctrl+E', Console.removeCurrentTab)
Keyboard.bindKeyDown('Ctrl+O', Game.requestChannels)
Keyboard.bindKeyDown('Ctrl+E', Console.removeCurrentTab)
end
function Console.destroy()

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'console'
dofile 'console'

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'containers'
dofile 'containers'

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'healthbar'
dofile 'healthbar'

@ -9,11 +9,11 @@ function Inventory.create()
inventoryWindow = displayUI('inventory.otui', { parent = Game.gameRightPanel })
inventoryButton = TopMenu.addGameButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
inventoryButton:setOn(true)
Hotkeys.bindKeyDown('Ctrl+I', Inventory.toggle)
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
end
function Inventory.destroy()
Hotkeys.unbindKeyDown('Ctrl+I')
Keyboard.unbindKeyDown('Ctrl+I')
inventoryWindow:destroy()
inventoryWindow = nil
inventoryButton:destroy()

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'inventory'
dofile 'inventory'

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'outfit'
dofile 'outfit'

@ -45,11 +45,11 @@ function Skills.create()
skillsWindow = displayUI('skills.otui', { parent = Game.gameRightPanel })
skillsWindow:hide()
skillsButton = TopMenu.addGameButton('skillsButton', 'Skills (Ctrl+S)', '/core_styles/icons/skills.png', Skills.toggle)
Hotkeys.bindKeyDown('Ctrl+S', Skills.toggle)
Keyboard.bindKeyDown('Ctrl+S', Skills.toggle)
end
function Skills.destroy()
Hotkeys.unbindKeyDown('Ctrl+S')
Keyboard.unbindKeyDown('Ctrl+S')
skillsButton:destroy()
skillsButton = nil
skillsWindow:destroy()

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'skills'
dofile 'skills'

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'textmessage'
dofile 'textmessage'

@ -4,4 +4,4 @@ Module
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'viplist'
dofile 'viplist'

@ -1,18 +1,18 @@
-- this file use loaded after everything is loaded and initialized
-- you can place any custom user code here
Hotkeys.bindKeyDown('F1', function() Game.talk('exura gran') end)
Hotkeys.bindKeyDown('F2', function() Game.talk('exori mort') end)
Hotkeys.bindKeyDown('F3', function() Game.talk('exori frigo') end)
Hotkeys.bindKeyDown('F4', function() Game.talk('exevo vis hur') end)
Hotkeys.bindKeyDown('F5', function() Game.talk('utani gran hur') end)
Hotkeys.bindKeyDown('F6', function() Game.talk('exani tera') end)
Keyboard.bindKeyDown('F1', function() Game.talk('exura gran') end)
Keyboard.bindKeyDown('F2', function() Game.talk('exori mort') end)
Keyboard.bindKeyDown('F3', function() Game.talk('exori frigo') end)
Keyboard.bindKeyDown('F4', function() Game.talk('exevo vis hur') end)
Keyboard.bindKeyDown('F5', function() Game.talk('utani gran hur') end)
Keyboard.bindKeyDown('F6', function() Game.talk('exani tera') end)
local function reload()
runscript('otclientrc.lua')
dofile('otclientrc.lua')
TextMessage.displayEventAdvance('Script otclientrc.lua reloaded.')
print('Script otclient.rc lua reloaded')
end
Hotkeys.bindKeyDown('Ctrl+R', reload)
Keyboard.bindKeyDown('Ctrl+R', reload)
rcloaded = true

@ -512,6 +512,22 @@ int LuaInterface::luaScriptLoader(lua_State* L)
}
}
int LuaInterface::luaScriptRunner(lua_State* L)
{
std::string fileName = g_lua.popString();
if(!boost::ends_with(fileName, ".lua"))
fileName += ".lua";
try {
g_lua.loadScript(fileName);
g_lua.call(0, LUA_MULTRET);
return g_lua.stackSize();
} catch(LuaException& e) {
logError("failed to load script file '", fileName, "' :'", e.what());
return 0;
}
}
int LuaInterface::luaErrorHandler(lua_State* L)
{
// pops the error message
@ -583,6 +599,10 @@ void LuaInterface::createLuaState()
pushCFunction(&LuaInterface::luaScriptLoader);
rawSeti(5);
pop(2);
// replace dofile
pushCFunction(&LuaInterface::luaScriptRunner);
setGlobal("dofile");
}
void LuaInterface::closeLuaState()

@ -186,6 +186,8 @@ public:
private:
/// Load scripts requested by lua 'require'
static int luaScriptLoader(lua_State* L);
/// Run scripts requested by lua 'dofile'
static int luaScriptRunner(lua_State* L);
/// Handle lua errors from safeCall
static int luaErrorHandler(lua_State* L);
/// Handle bound cpp functions callbacks

Зареждане…
Отказ
Запис