简体   繁体   中英

Lua: What's the difference between null and nil?

I'm developing a plugin for Oxide 2 . I've been learning from other plugins and I've noticed that some of them use null instead of nil . For example:

if args[1] == null then

Oxide 2 is written in C#, so I assume that null is defined in C# or in Lua Interface.

Is there any difference between them?


Update: I've somewhere read that it can be used for check, if MySQL column is NULL . Is that true?

nil is a value in the Lua language.

null is a variable name. What value does it contain? You can easily check that. We cannot. If it turns out to be nil , then using null is pointless, probably a mistake made by someone context switching between C# and Lua code which accidentally works because an undefined variable will evaluate to nil .

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