Ternary Operators

  1. Describe your reason for requesting this feature. What problems are you running into?
    I would love to see ternary operators in PulpScript.

It could shorten lines like

if turn=="player" then
	performingMoveTile = playerMonsterId
else
	performingMoveTile = enemyMonsterId
end

to a single line like

performingMoveTile = turn=="player" ? playerMonsterId : enemyMonsterId

You can do this in Lua/PulpScript(I think?) now, it just doesn't look like your typical ternary:

performingMoveTile = turn == "player" and playerMonsterId or enemyMonsterId
2 Likes

Nope.

  • You can't use "and" in Pulp.
  • You can't use "or" in Pulp.