-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behavior under NetLogoWeb #18
Comments
Can you use `table:has-key?` for checking that?
…On Wed, Jun 21, 2023 at 11:49 AM arcpaolo ***@***.***> wrote:
When running this code:
extensions [ table ]
globals [ $#table $t1 ]
to go
set $#table table:make
set $t1 table:get $#table "Test"
end
In the desktop version (6.3.0) you get and error: "Extension exception: No
value for Test in table."
However, when running in NetLogoWeb, you don't get an error, you get
"undefined".
I have some code that checks to see if a certain table key already exists
to avoid overwriting. I used "carefully [ ]" and then ignored the error if
there was no such key. When I run on NLW this check no longer works.
As a stop-gap, is there a way to test if a variable is "undefined"? I
could not figure out how to do this. It's not a boolean nor does it seem to
be a primitive of any sort.
—
Reply to this email directly, view it on GitHub
<#18>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC523N3S2TCT4UPRLGNS46LXMMQ2ZANCNFSM6AAAAAAZPA3KDE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Ah, of course. I should have thought of that, I just tried it and it works. Nonetheless it would be useful if the behavior were consistent. I am also curious how one can check if a variable is undefined in NLW. |
Thanks for reporting this. I have a fix here and will merge it and close this issue once tests pass. There was a check for a missing key for a key with a list value, but no check for simple valued keys. There was a test for this here in the desktop repo, but somehow that test got dropped when the extension was ported to NetLogo Web. At some point we should get those tests back in sync, but for now I just added a new one to Tortoise.
So, in theory this should never be necessary. NetLogo doesn't allow an |
Thank you! |
When running this code:
In the desktop version (6.3.0) you get an error: "Extension exception: No value for Test in table."
However, when running in NetLogoWeb, you don't get an error, $t1 is set to "undefined".
I have some code that checks to see if a certain table key already exists to avoid overwriting. I used "carefully [ ]" and then ignored the error if there was no such key. When I run on NLW this check no longer works.
As a stop-gap, is there a way to test if a variable is "undefined"? I could not figure out how to do this. It's not a boolean nor does it seem to be a primitive of any sort.
The text was updated successfully, but these errors were encountered: