68
you are viewing a single comment's thread
view the rest of the comments
[-] SlurpingPus@lemmy.world 4 points 1 day ago* (last edited 1 day ago)

Nil doesn't exist as a value in Lua, because a variable or a field that don't exist or are unassigned are indistinguishable from a nil value, since they all return nil when evaluating. In particular, this leads to the situation that you can't have a table where some of the fields are assigned nil as the value, because those fields effectively don't exist.

[-] thingsiplay@lemmy.ml 1 points 1 day ago

Ah I see, that makes it clear. I guess it is a "good enough" solution where it doesn't matter in real world.

[-] SlurpingPus@lemmy.world 2 points 1 day ago

I'm guessing it's more of a stylistic choice. Lisps typically work the same way, except they can retrieve the full map structure even if some fields contain nil as the value.

Unfortunately, Lua's approach hinders exchanging structures with null values with other environments: see my comment here.

this post was submitted on 12 Feb 2026
68 points (100.0% liked)

Programming

25545 readers
980 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS