@@ -8,9 +8,10 @@ if not selfsource then
88 end
99end
1010
11+ local IsWindows = package.config :sub (1 , 1 ) == " \\ "
1112local root = selfsource
12- :match " (.+)[/][^/]+$"
13- :match " (.+)[/][^/]+$"
13+ :match " (.+)[/][^/]+$"
14+ :match " (.+)[/][^/]+$"
1415
1516if debug.getregistry ()[" lua-debug" ] then
1617 local dbg = debug.getregistry ()[" lua-debug" ]
4748
4849local function detectLuaDebugPath (cfg )
4950 local PLATFORM
50- local function isWindows ()
51- return package.config :sub (1 , 1 ) == " \\ "
52- end
5351 do
5452 local function shell (command )
5553 -- NOTICE: io.popen可能会多线程不安全
@@ -93,7 +91,7 @@ local function detectLuaDebugPath(cfg)
9391 error " unknown ARCH"
9492 end
9593 end
96- if isWindows () then
94+ if IsWindows then
9795 detect_windows ()
9896 else
9997 local name = shell ' uname -s'
@@ -133,7 +131,7 @@ local function detectLuaDebugPath(cfg)
133131 error (_VERSION .. " is not supported." )
134132 end
135133
136- local ext = isWindows () and " dll" or " so"
134+ local ext = IsWindows and " dll" or " so"
137135 return root .. rt .. ' /luadebug.' .. ext
138136end
139137
@@ -148,8 +146,7 @@ local function initDebugger(dbg, cfg)
148146 luadebug = detectLuaDebugPath (cfg )
149147 updateenv = true
150148 end
151- local isWindows = package.config :sub (1 , 1 ) == " \\ "
152- if isWindows then
149+ if IsWindows then
153150 assert (package.loadlib (luadebug , ' init' ))(cfg .luaapi )
154151 end
155152
@@ -163,7 +160,7 @@ local function initDebugger(dbg, cfg)
163160 end
164161
165162 local function utf8 (s )
166- if cfg .ansi and isWindows then
163+ if cfg .ansi and IsWindows then
167164 return dbg .rdebug .a2u (s )
168165 end
169166 return s
@@ -208,7 +205,7 @@ function dbg:event(...)
208205end
209206
210207function dbg :set_wait (name , f )
211- _G [name ] = function (...)
208+ _G [name ] = function (...)
212209 _G [name ] = nil
213210 f (... )
214211 self :event ' wait'
@@ -221,7 +218,7 @@ function dbg:setup_patch()
221218 local rawxpcall = xpcall
222219 function pcall (f , ...)
223220 return rawxpcall (f ,
224- function (msg )
221+ function (msg )
225222 self :event (" exception" , msg , ERREVENT_ERRRUN , 3 )
226223 return msg
227224 end ,
@@ -230,7 +227,7 @@ function dbg:setup_patch()
230227
231228 function xpcall (f , msgh , ...)
232229 return rawxpcall (f ,
233- function (msg )
230+ function (msg )
234231 self :event (" exception" , msg , ERREVENT_ERRRUN , 3 )
235232 return msgh and msgh (msg ) or msg
236233 end
@@ -251,7 +248,7 @@ function dbg:setup_patch()
251248 function coroutine .wrap (f )
252249 local wf = rawcoroutinewrap (f )
253250 local _ , co = debug.getupvalue (wf , 1 )
254- return function (...)
251+ return function (...)
255252 self :event (" thread" , co , 0 )
256253 return coreturn (co , wf (... ))
257254 end
0 commit comments