functions

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
ianmitroff
Posts: 1
Joined: Fri Jun 30, 2006 8:54 pm

functions

Post by ianmitroff »

i can't seem to get a simple function to work

if enter a simple function within a button and then call it, i get an error saying that it can't be found

there is no error when i compile the script within the button, so what gives? where do you place a function that you've created and want to call?
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: functions

Post by jmburnod »

Hi ianmitroff,

And welcome on this forum
Can you post your function. It is to easy for help you

Best regards

Jean-Marc
https://alternatic.ch
mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3582
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: functions

Post by mwieder »

My guess without seeing your code is that you're calling it with the syntax of a command instead of a function

Code: Select all

on mycommand
  put "hello, world"
end mycommand

function myfunction
  return 3
end myfunction

mycommand -- execute the command "mycommand"
put myfunction() -- return the result of the function "myfunction"
myfunction -- wrong calling syntax
jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 121
Joined: Fri Mar 09, 2007 9:47 pm

Re: functions

Post by jsburnett »

I would put the function in the card script if only used on that card, otherwise the stack script if other cards call this function.
Hope this helps.
Post Reply