Invalid lua type in __data


Hey all,

I’m struggling with an issue that I cannot figure out. I’m using a function in a few resources that give the user the keys of a newly spawned vehicle. Now with esx_policejob, this works fine, but with esx_eden_garage it does not. This is the error I’m getting:

[   1182125] Error running call reference function for resource esx_eden_garage: citizen:/scripting/lua/scheduler.lua:403: Invalid Lua type in __data
[   1182125] stack traceback:
[   1182125] 	[C]: in global '_in'
[   1182140] 	GetVehicleNumberPlateText.lua:2: in function 'GetVehicleNumberPlateText'
[   1182140] 	client.lua:155: in function 'AddVehicleKeys'
[   1182140] 	client.lua:198: in upvalue 'ref'
[   1182140] 	citizen:/scripting/lua/scheduler.lua:389: in function <citizen:/scripting/lua/scheduler.lua:388>
[   1182156] 	[C]: in function 'xpcall'
[   1182156] 	citizen:/scripting/lua/scheduler.lua:388: in function <citizen:/scripting/lua/scheduler.lua:387>
[   1182156] stack traceback:
[   1182156] 	[C]: in function 'error'
[   1182171] 	citizen:/scripting/lua/scheduler.lua:403: in function <citizen:/scripting/lua/scheduler.lua:372>
[   1182171] Error resuming coroutine: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
[   1182171] stack traceback:
[   1182187] 	[C]: in function 'error'
[   1182187] 	citizen:/scripting/lua/MessagePack.lua:830: in method 'underflow'
[   1182187] 	citizen:/scripting/lua/MessagePack.lua:465: in field 'any'
[   1182187] 	citizen:/scripting/lua/MessagePack.lua:860: in field 'unpack'
[   1182203] 	citizen:/scripting/lua/scheduler.lua:626: in upvalue 'cb'
[   1182203] 	client/functions.lua:368: in function <client/functions.lua:342>

I found this quite odd, because I’m using this function exactly the same way as in the other resource. This is the function:

function AddVehicleKeys(localVehicle)
    local localVehPlateTest = GetVehicleNumberPlateText(localVehicle)
    if localVehPlateTest ~= nil then
        local localVehPlate = string.lower(localVehPlateTest)
        TriggerEvent('ls:newVehicle', localVehPlate, localVehPlate, nil)

And this is how I call the function (last bit of code, I swear)

function SpawnVehicle(vehicle)

	ESX.Game.SpawnVehicle(vehicle.model, {
		x = this_Garage.SpawnPoint.Pos.x ,
		y = this_Garage.SpawnPoint.Pos.y,
		z = this_Garage.SpawnPoint.Pos.z + 1											
		},120, function(callback_vehicle)
		ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
	TriggerServerEvent('eden_garage:modifystate', vehicle, false)


Am I just forgetting something, going mad or am I doing it wrong?