you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 2 years ago* (1 child)

You don't need the and right? Can't it just be return a or b

This doesn't work if a is falsy non-null actually

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 2 years ago

    it’s just return a and b or c is the closest Lua has to a ternary operator, but yes, for the above you could shorten it to return a or b (“or returns the first argument if true, otherwise second argument is returned”)

  • source
  • parent