reduce possibility of errors in love code when overwriting built-in lua APIs

This commit is contained in:
Sasha Szpakowski
2025-03-31 19:13:25 -03:00
parent 58a42e2c35
commit de5495bb03
4 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ misrepresented as being the original software.
local table_concat = table.concat
local ipairs = ipairs
local pcall = pcall
local pcall, type, error = pcall, type, error
local graphics = love.graphics
function graphics.newVideo(file, settings)
+3 -1
View File
@@ -441,6 +441,8 @@ function love.init()
end
end
local xpcall = xpcall
local coroutine_yield = coroutine.yield
local print, debug, tostring = print, debug, tostring
local function error_printer(msg, layer)
@@ -498,7 +500,7 @@ return function()
end
local _, retval, restartvalue = xpcall(func, deferErrhand)
if retval then return retval, restartvalue end
coroutine.yield()
coroutine_yield()
end
return 1
+1
View File
@@ -202,6 +202,7 @@ function love.run()
end
end
local pcall, table = pcall, table
local debug, print, tostring, error = debug, print, tostring, error
function love.threaderror(t, err)
+1 -1
View File
@@ -34,7 +34,7 @@ end
local status, ffi = pcall(require, "ffi")
if not status then return end
local tonumber, assert, error = tonumber, assert, error
local tonumber, assert, error, type = tonumber, assert, error, type
local floor = math.floor
local float = ffi.typeof("float")