简体   繁体   中英

Error attempt to index a nil value (upvalue "cfg)

I was moving some map files, and I rebooted my server (FiveM) and when I called it again it started to give this problem, I undo everything I did, I put the old files again, but the error kept happening. And I do not know what to do to solve it.

I threw all the changed files back to normal, but it did not solve anything.

local cfg = module("cfg/blips_markers")

-- add additional static blips/markers
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
  if first_spawn then
    for k,v in pairs(cfg.blips) do
      vRPclient.addBlip(source,{v[1],v[2],v[3],v[4],v[5],v[6]})
    end

    for k,v in pairs(cfg.markers) do
      vRPclient.addMarker(source,{v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11]})
    end
  end
end)

Inside the server the blip_markes are gone and some player data too, because of that.

A quick debug would be to assign cfg the value of an integer, if your problem solves, you know that something is wrong with module("cfg/blips_markers") . However, please provide the code associated with module("cfg/blips_markers") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM