简体   繁体   中英

lua error when running Garry's Mod server

[ERROR] gamemodes/starwarsrp/gamemode/modules/base/sv_gamemode_functions.lua:256: attempt to index local 'jobTable' (a nil value)  
  1. unknown - gamemodes/starwarsrp/gamemode/modules/base/sv_gamemode_functions.lua:256

Here is line 256 and 257:

 256 if jobTable.ShowSpare2 then
 257      return jobTable.ShowSpare2(ply)

jobTable is nil . It is not allowed to index nil values. That measn you may not write something like jobTable[1] or jobTable.ShowSpare(ply) .

Either find out why jobTable is nil in your code or if you cannot ensure it is not nil, avoid indexing it by doing something like

if jobTable then return jobTable.ShowSpare(ply)

or

return jobTable and jobTable.ShowSpare(ply)

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