Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 816
Genhis Avatar asked Jul 09 '15 16:07

Genhis


1 Answers

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.

like image 76
Mud Avatar answered Sep 29 '22 08:09

Mud