所以代码错误是这样的:另外,lua代码用于FiveM编码,使用vRP作为主要框架。该错误对 vRP 上的函数提出上诉,而调用者是工件中的基本函数。
即便如此,这是触发错误的工件的代码
local GetGameTimer = GetGameTimer
local _sbs = Citizen.SubmitBoundaryStart
local coresume, costatus = coroutine.resume, coroutine.status
local debug = debug
local coroutine_close = coroutine.close or (function(c) end) -- 5.3 compatibility
local hadThread = false
local curTime = 0
-- setup msgpack compat
msgpack.set_string('string_compat')
msgpack.set_integer('unsigned')
msgpack.set_array('without_hole')
msgpack.setoption('empty_table_as_array', true)
-- setup json compat
json.version = json._VERSION -- Version compatibility
json.setoption("empty_table_as_array", true)
json.setoption('with_hole', true)
-- temp
local _in = Citizen.InvokeNative
local function FormatStackTrace()
return _in(`FORMAT_STACK_TRACE` & 0xFFFFFFFF, nil, 0, Citizen.ResultAsString())
end
local function ProfilerEnterScope(scopeName)
return _in(`PROFILER_ENTER_SCOPE` & 0xFFFFFFFF, scopeName)
end
local function ProfilerExitScope()
return _in(`PROFILER_EXIT_SCOPE` & 0xFFFFFFFF)
end
local newThreads = {}
local threads = setmetatable({}, {
-- This circumvents undefined behaviour in "next" (and therefore "pairs")
__newindex = newThreads,
-- This is needed for CreateThreadNow to work correctly
__index = newThreads
})
local boundaryIdx = 1
local runningThread
local function dummyUseBoundary(idx)
return nil
end
local function getBoundaryFunc(bfn, bid)
return function(fn, ...)
local boundary = bid or (boundaryIdx + 1)
boundaryIdx = boundaryIdx + 1
bfn(boundary, coroutine.running())
local wrap = function(...)
dummyUseBoundary(boundary)
local v = table.pack(fn(...))
return table.unpack(v)
end
local v = table.pack(wrap(...))
bfn(boundary, nil)
return table.unpack(v)
end
end