Hi Romeo, On Fri, Mar 27, 2009 at 7:39 PM, Romeo <[email protected]> wrote: > is there any way to predefine a function or a variable? > something like i can do in C header files?
If I understood correctly your question, yes: liquidsoap is a programming language. For example, the file utils.liq (http://savonet.rastageeks.org/browser/trunk/liquidsoap/scripts/utils.liq) is automatically loaded by liquidsoap and contains lots of such definitions. In your own code you can define whatever you want, e.g. string, sources, operators: password = "foo" default = single("default.ogg") make_safe = fun (s) -> fallback(track_sensitive=false,[s,blank()]) or equivalently for the last one: def make_safe(s) fallback(track_sensitive=false,[s,blank()]) end There are things that cannot be done in liquidsoap (it's only a simple functional language): - no recursive definition (in particular no recursive function) - no assignation: when you write x = foo, you define x to be foo in the following expression, it is not a variable assignation as in C for example: x = 3 if test() then x = 2 end # here x is 3 again, independently of the test # perhaps you wanted to write x = if test() then 2 else 3 end # here the value of x depends on what the test was Does that answer your question? -- David ------------------------------------------------------------------------------ _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
