Custom Functions not working for me? What am I doing?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Mattjwlittler
Posts: 4
Joined: Sun Sep 11, 2016 12:20 pm

Custom Functions not working for me? What am I doing?

Post by Mattjwlittler »

Hi, I'm having issues getting custom functions to work.

I'm on LC 7.1 on Mac

I've tried applying the example functions provided in the LC documentation (below) but when I click "Apply" I get an error near "function". Don't understand... and my app is going to be crazy without callable functions...
Tx in advance for your help.
Matt

function Summy
put 1 + 1 into tSummy
return tSummy
end Summy

or

function myFunction
return "test"
end myFunction

or

function boomboom
answer "Boom"
end boomboom
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Custom Functions not working for me? What am I doing?

Post by jmburnod »

Hi Matt
Welcome to this forum
Amazing !
I tested your three functions without error (Mac, LC 7.06,7.1, indy).
Best regards
Jean-Marc
https://alternatic.ch
Mattjwlittler
Posts: 4
Joined: Sun Sep 11, 2016 12:20 pm

Re: Custom Functions not working for me? What am I doing?

Post by Mattjwlittler »

Thanks Jean-Marc. I'll do some more testing with a new stack / different version of LC.
Mattjwlittler
Posts: 4
Joined: Sun Sep 11, 2016 12:20 pm

Re: Custom Functions not working for me? What am I doing?

Post by Mattjwlittler »

There's a lesson. Always try what you're doing with a clean slate if it doesn't work the way you think. I was trying to declare it inside the on OpenCard... :oops:
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Custom Functions not working for me? What am I doing?

Post by jmburnod »

I was trying to declare it inside the on OpenCard... :oops:
Congratulation. You now can do

Code: Select all

on opencard
  get summy() 
  answer it
end opencard
https://alternatic.ch
Mattjwlittler
Posts: 4
Joined: Sun Sep 11, 2016 12:20 pm

Re: Custom Functions not working for me? What am I doing?

Post by Mattjwlittler »

Exactly. Calling inside events is what I want - obviously declaring there doesn't help anyone...
Post Reply