function trace(event, line) local s = debug.getinfo(2).short_src if not s:match('%[string') then return end DebugLabel.Caption = "last line executed: "..line end frmLuaTableScript = getMainForm().frmAutoInject frmLuaTableScriptPanel1OnResizeOLD = frmLuaTableScript.Panel1.OnResize frmLuaTableScript.Panel1.OnResize = function (sender) frmLuaTableScriptPanel1OnResizeOLD(sender) DebugButton.Top = Button.Top - 8 DebugButton.Left = Button.Left + 50 DebugLabel.Top = Button.Top + 18 DebugLabel.Left = Button.Left + 55 Button.Left = Button.Left - 80 end debugOnOffFlag = false Button = frmLuaTableScript.Button1 Button.AutoSize = true DebugLabel = createLabel(frmLuaTableScript.Panel1) DebugLabel.AutoSize = true DebugLabel.Caption = "debug disabled" DebugButton = createButton(frmLuaTableScript.Panel1) DebugButton.AutoSize = true DebugButton.Caption = "Find faulty line" DebugButton.Height = Button.Height DebugButton.OnClick = function () debugOnOffFlag = not debugOnOffFlag if debugOnOffFlag then debug.sethook(trace, "l") DebugButton.Font.Style = '[fsBold]' DebugLabel.Caption = "last line executed:" else debug.sethook() DebugButton.Font.Style = '[]' DebugLabel.Caption = "debug disabled" end end --[=[--Example-- RequiredCEVersion=6.3 if (getCEVersion==nil) or (getCEVersion()