mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
reduce possibility of errors in love code when overwriting built-in lua APIs
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user