Post Reply 

Need some help with returning values.

Feb 22, 2014, 23:56
Post: #1
Need some help with returning values.
I've been setting up a script to automate making UI items in the design I want. The issue that I'm running across is that in part of my script I have a function that is supposed to be returning 3 layers in a list.

In the main part of the script, I'm trying to grab that list (set up as (list layerA layerB layerC) for the return) and store each layer into a backup layer for later use. The issue that I'm running into is that when I try and grab what I thought would be the first element of that list it complains that it needs a pair for car and I'm not sure what is causing it.

Code sample:

(set! tempStorage (make-ui-text TextElement Element NAME IMAGE ) )
(set! BrightTEStorage (car tempStorage) ) ;store the bright text element to ensure its
;not accidentally removed without being saved
(set! TextElementStorage (cadr tempStorage) ) ;store the text element to ensure its
;not accidentally removed without being saved
(set! ElementStorage (caddr tempStorage) ) ;store the base element to ensure its
;not accidentally removed without being saved
Find all posts by this user
Quote this message in a reply
Feb 23, 2014, 23:01 (This post was last modified: Feb 23, 2014 23:04 by oconzer.)
Post: #2
RE: Need some help with returning values.
I see now what I did wrong. I had done like you had for your example, the only thing that I didn't know I had to do for my function was to put the list at the last part.

Sample Code:

(define (make-ui-text drawable background name image)
(let*
(
; variables for the function to use
(lastlayer)
(currentlayer)
(return) ;list to make to return
)
; do function stuff
(set! return (list lastlayer background currentlayer) )
; this part is what I didn't realize I needed to do since I thought the last variable of the let
; was what was returned
return ;<---part that I didn't know I had to do
)
)

then:

(set! tempStorage (make-ui-text TextElement Element NAME IMAGE ) )
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  returned no return values error drone 2 1,850 May 26, 2012 14:02
Last Post: drone

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS