Thanks Alex.

So we have the following 2 equivalent methods to check for existence of a member that work for all dir version:

on memberExists (tMemRef)
  if voidP(tMemRef) then return FALSE
  return (tMemRef.number > 0)
end

on memberExists (tMemRef)
  if ilk(tMemRef)<>#member then return FALSE
  return (tMemRef.type<>#empty)
end

unfortunately both require 2 lines of code, I was hoping for a one-line solution.

Cheers,
Valentin


Alex da Franca wrote:
Am 07.10.2005 um 18:25 schrieb Valentin Schmidt:

hi list,

does anyone know a way to check for the existence of a member with
a given name that works for both dmx and dmx2004?
I know the following 2 methods, but it would be nicer to have a
consistent method for all versions:

on memberExists  (someName)
 return (member(someName).membernum > 0) -- only for dir < 10
 return (not voidP(member(someName))) -- only for dir >=10
end

here's what I use:


on mGetMemType memref
  if ilk(memref) <> #member then return #empty
  return memref.type
end



if mGetMemType(member("something")) = #bitmap then ....


I didn't come up with a one-liner.

while I appreciate the fact, that lingo is much more consistent and
tidy since D10,  I liked the old *sluggish* behavior of returning
always a member reference of type #empty regardless what.

since very much of my code relied on that I continued to use it via
my own "two line" check.



---------------------------

  |||
a¿ex


[To remove yourself from this list, or to change to digest mode, go
to http://www.penworks.com/lingo-l.cgi  To post messages to the list,
email [email protected]  (Problems, email
[EMAIL PROTECTED]). Lingo-L is for learning and helping with
programming Lingo. Thanks!]

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to