Functions in the on-rev - LC server script

Devin Asay devin_asay at byu.edu
Tue Nov 16 11:59:50 EST 2010


On Nov 16, 2010, at 9:40 AM, paolo mazza wrote:

> How can I place a function in a on-rev - CGI server script ?
> I have to port a stack script (with commands and functions) to a .irev text
> file for the  on-rev  server .
> I expected something similar to the following script...
> 
> <?rev
>   put MyFunction() into tVAR1
>   put tVAR1
> 
> function MyFunction
>   put 1 + 1 into VAR2
>   return VAR2
> end MyFunction
> 
> ?>
> ... but obviously it does not work !!!
> 
> Any idea?

Paolo,

In irev scripts you have to declare the function before you call it, so just put the function handler at the top:

<?rev
function MyFunction
  put 1 + 1 into VAR2
  return VAR2
end MyFunction

  put MyFunction() into tVAR1
  put tVAR1

?>

Regards,

Devin


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the Use-livecode mailing list