Closed BawdyInkSlinger closed 3 years ago
This is likely because undefined
can't be serialized as it's not a valid JSON type, and is therefore not really supported by SugarCube. Still, it would probably be better if the value were deleted instead of being massaged into a null
.
As a sort of stylistic rule though, null
is what is generally recommended for when you want to set a value to "nothing" as undefined
is used when the value has never been set in the first place. If you want to make something undefined
, usually the delete
operator (or <<unset>>
) is used.
Still, it would probably be better if the value were deleted instead of being massaged into a null
Yep, that's the behavior I would want.
Yep, that's the behavior I would want.
If that is the case then why do you do a <<set $my_var to undefined>>
instead of a <<unset $my_var>>
?
I'm saying this as fallback behavior. I'd prefer it to remain set to undefined, but I'm accepting that JSON doesn't allow that.
Resolved by b64afa6.
using the unset macro does not reproduce this issue.
Expected behavior: refreshing the page should alert
undefined
.