Re: we need official libs : Swap

new topic     » topic index » view thread      » older message » newer message

Yeah, and we can write wrappers for functions like get_position().
But this only sounds like a hack for the problems we currently face.


global function get_position_x()
  sequence temp

  temp = get_position()
  return temp[1]
end function

global function get_position_y()
  sequence temp

  temp = get_position()
  return temp[2]
end function


        Lucius L. Hilley III
        lhilley at cdc.net   lucius at ComputerCafeUSA.com
+----------+--------------+--------------+----------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  | Computer |
|  Horse   +--------------+--------------+  Cafe'   |
| Software | http://www.cdc.net/~lhilley |  USA     |
+----------+-------+---------------------+----------+
                   | http://www.ComputerCafeUSA.com |
                   +--------------------------------+
> ---------------------- Information from the mail
header -----------------------
> Poster:       Lewis Townsend <keroltarr at HOTMAIL.COM>
> Subject:      Re: we need official libs : Swap
> --------------------------------------------------------------------------
-----
>
> Lionel Wong wrote:
>
> >As mentioned in the reference manual, subscripting expressions is not
> >supported because that would wastefully discard some already calculated
> >values. There is a purpose for value() to return more than the result
> >called
> >for: error-handling. The correct use of value() would be--
> >
> >include get.e
> >sequence getval
> >atom num
> >getval = value("7")
> >if getval[1] = GET_SUCCESS
> >    then num = getval[2]
> >    else .... -- handle the invalid crap that obviously wasn't "7"
> >end if
> >
> >Lionel Wong
>
> Yes, and that is how I do it unless I'm wanting a
> quick sthortcut to get a number. Notice that the
> "correct" example you gave requires 2 variables and
> 2 instances of subscripting where as my suggested
> example would only requre one variable and only need
> to be subscripted once because it could be done at
> the function call.  I suppose I can always make my
> own shortcut-value-function this way:
>
> function val (sequence s)
>   sequence getval
>   getval = value (s)
>   return getval [2]
> end function
>
> or even one that does the error handling for me:
>
> function val (sequence s)
>   sequence getval
>   getval = value (s)
>   if getval [1] = GET_SUCCESS then
>     return getval [2]
>   else
>     puts (1, "\nError using value()")
>     abort (1)
>   end if
> end function
>
> Then all I have to do is something like:
> num = val("7")
>
> later
> Lewis Townsend
>
>
> _______________________________________________________________
> Get Free Email and Do More On The Web. Visit http://www.msn.com
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu