| To: | REALbasic NUG <realbasic-nug at lists dot realsoftware dot com> |
|---|---|
| Subject: | Re: Dictionary lookup confuses me |
| From: | Joe Strout <joe at inspiringapps dot com> |
| Date: | Wed, 30 Apr 2008 08:27:30 -0600 |
| Authentication-results: | mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com |
| Delivered-to: | listarchive at realsoftware dot com |
| Delivered-to: | realbasic-nug at lists dot realsoftware dot com |
| References: | <59FCF004-8000-426D-BF76-3EAECBC61743 at macsos dot com dot au> |
On Apr 29, 2008, at 9:56 PM, Gerard Hammond wrote:
> if n.Lookup("thiskey", -1) Then
You're using Lookup, which returns a Variant, in a context that
requires a Boolean, so (unfortunately) REALbasic cheerfully converts
whatever value it finds to a Boolean for you. I'm not sure it's even
documented exactly how it does that, but certainly 0 converts to
False, and 1 converts to True.
HasKey is the method you were looking for. Or, you could use
if n.Lookup("thiskey", -1) <> -1 then
Best,
- Joe
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Encodings and GetSaveInfo, Joe Strout |
|---|---|
| Next by Date: | PostgreSQLDatabase Connections, Robert Lawrence |
| Previous by Thread: | Re: Dictionary lookup confuses me, Norman Palardy |
| Next by Thread: | REALbasic is in trouble, Trausti Thor Johannsson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |