Hi!

2011/7/30 okay_awright <[email protected]>:
> I've got a specific question related to how Liquidsoap scripts work.
> I'd like to 'propagate' an updated value from outside the definition of
> a function, and not rely on global variables.
> I was wondering how the *ref* keyword works, is it used to support
> C-like pointers? I can't find the specific help page right now.
> Say I've got a function "dummy_procedure" and I'd like to 'export' a
> variable from outside the scope of this function, the caveat is that the
> return value is already used for something else.
> Can I use the *ref* keyword somehow to avoid composite return values
>        def dummy_procedure(_ref_x) =
>                _ref_x = 5
>                7
>        end
>        x = 4
>        ref_x = ref x;
>        y = dummy_procedure(ref_x)
> or should I use lists or maps to return both x and y from
> dummy_procedure at the same time?

Variable references works as follows:
# Setup a reference
x = ref 1234

# Update the reference
x := 4567

# Retrieve the reference
y = !x

Does that answer your question?

Cheers,
Romain

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to