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

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

functions

Post by ianmitroff » Wed Dec 22, 2010 8:08 pm

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: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: functions

Post by jmburnod » Wed Dec 22, 2010 8:58 pm

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: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: functions

Post by mwieder » Wed Dec 22, 2010 9:37 pm

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 » Tue Jan 04, 2011 10:07 pm

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