mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-31 15:43:00 +00:00 
			
		
		
		
	minor cleanup
This commit is contained in:
		| @@ -42,5 +42,5 @@ end | ||||
|  | ||||
| -- non-standard - will raise error instead | ||||
| os.exit = function(code) | ||||
| 	error(code) | ||||
| 	error(code or 0) | ||||
| end | ||||
|   | ||||
| @@ -60,7 +60,7 @@ function Routine:resume(event, ...) | ||||
| 		end | ||||
|  | ||||
| 		if not s and event ~= 'terminate' then | ||||
| 			if m and debug and debug.traceback then | ||||
| 			if m and type(debug) == 'table' and debug.traceback then | ||||
| 				local t = (debug.traceback(self.co, 1)) or '' | ||||
| 				m = m .. '\n' .. t:match('%d\n(.+)') | ||||
| 			end | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| -- https://www.lua.org/manual/5.1/manual.html#pdf-require | ||||
|  | ||||
| local function split(str, pattern) | ||||
| 	local t = { } | ||||
| 	local function helper(line) table.insert(t, line) return "" end | ||||
| @@ -65,14 +67,14 @@ return function(env) | ||||
| 			local sPath = string.gsub(pattern, "%?", fname) | ||||
| 			-- TODO: if there's no shell, we should not be checking relative paths below | ||||
| 			-- as they will resolve to root directory | ||||
| 			if env.shell and | ||||
| 				type(env.shell.getRunningProgram) == 'function' and | ||||
| 				sPath:sub(1, 1) ~= "/" then | ||||
| 			if env.shell | ||||
| 				and type(env.shell.getRunningProgram) == 'function' | ||||
| 				and sPath:sub(1, 1) ~= "/" then | ||||
|  | ||||
| 				sPath = fs.combine(fs.getDir(env.shell.getRunningProgram() or ''), sPath) | ||||
| 			end | ||||
| 			if fs.exists(sPath) and not fs.isDir(sPath) then | ||||
| 				return loadfile(sPath, env) | ||||
| 				return loadfile(fs.combine(sPath, ''), env) | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
|   | ||||
| @@ -78,8 +78,6 @@ local function trim_traceback(stack) | ||||
| end | ||||
|  | ||||
| return function (fn, ...) | ||||
| 	-- xpcall in Lua 5.1 does not accept parameters | ||||
| 	-- which is not ideal | ||||
| 	local args = { ... } | ||||
| 	local res = table.pack(xpcall(function() | ||||
| 		return fn(table.unpack(args)) | ||||
| @@ -88,6 +86,10 @@ return function (fn, ...) | ||||
| 	if not res[1] and res[2] ~= nil then | ||||
| 		local err, trace = trim_traceback(res[2]) | ||||
|  | ||||
| 		if err:match(':%d+: 0$') then | ||||
| 			return true | ||||
| 		end | ||||
|  | ||||
| 		if #trace > 0 then | ||||
| 			_G._syslog('\n' .. err .. '\n' .. 'stack traceback:') | ||||
| 			for _, v in ipairs(trace) do | ||||
| @@ -95,10 +97,6 @@ return function (fn, ...) | ||||
| 			end | ||||
| 		end | ||||
|  | ||||
| 		if err:match(':%d+: 0$') then | ||||
| 			return true | ||||
| 		end | ||||
|  | ||||
| 		return res[1], err, trace | ||||
| 	end | ||||
|  | ||||
|   | ||||
| @@ -19,6 +19,8 @@ UI.Button.defaults = { | ||||
| 		[ ' ' ] = 'button_activate', | ||||
| 		enter = 'button_activate', | ||||
| 		mouse_click = 'button_activate', | ||||
| 		mouse_doubleclick = 'button_activate', | ||||
| 		mouse_tripleclick = 'button_activate', | ||||
| 	} | ||||
| } | ||||
| function UI.Button:layout() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kepler155c@gmail.com
					kepler155c@gmail.com