简体   繁体   中英

LUA How to fix Garry's Mod weapon? (attempt to compare nil with number)

In the lua I get a error called (attempt to compare nil with number)

It is at this point line 21 if CurTime() > self.LifeTime then return false end

CurTime() > self.LifeTime compares two values.

The error tells you that one of them is a number and the other one is nil. You cannot compare something with nil so Lua doesn't know what to do

print both values to find out which one is nil and which one is a number. Then find out why it is nil and fix that or avoid to compare them in that case.

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