problem with counting words

larry at significantplanet.org larry at significantplanet.org
Sun Oct 12 21:58:21 EDT 2014


Hi Robert,
I understand what you wrote.  That is not a problem for me.
What I want is to be able to put my function into the LC IDE so that I can 
use it in other stacks.
You mention a library stack.  I do not know how to make one or use one. Is 
there some tutorial or something that will tell me how?
Thanks,
Larry

----- Original Message ----- 
From: "Robert Brenstein" <rjb at robelko.com>
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Sent: Sunday, October 12, 2014 7:15 PM
Subject: Re: problem with counting words


> Larry,
>
> Change the first line of your function to
>
> function commaInsert thisFigure
>
> Better yet:
>
> function commaInsert pFigure
> put pFigure into thisFigure
>
> Then add before the last end the following line
>
> return thisFigure
>
> If you have your function anywhere in the path (like in the stack script 
> or library stack that is in use), then the following will work as you want
>
> put commaInsert(thisFigure) into field "myDollarDisplay"
>
> Robert
>
>
> On 12.10.2014 at 17:09 Uhr -0600 <larry at significantplanet.org> apparently 
> wrote:
>>Hi Craig,
>>I've written several functions within stacks, but have no idea how to 
>>create a library stack or, seems better, as a plug-in.
>>For example, one function I use in many of the programs I'm writing is: 
>>commaInsert:
>>
>>on commaInsert
>>
>>put round(thisFigure) into thisFigure
>>
>>if thisFigure < 0 then put thisFigure * -1 into thisFigure
>>
>>put the length of thisFigure into L
>>
>>if L > 3 then put "," before char -3 of thisFigure
>>
>>put the length of thisFigure into L
>>
>>if L > 7 then put "," before char -7 of thisFigure
>>
>>put the length of thisFigure into L
>>
>>if L > 11 then put "," before char -11 of thisFigure
>>
>>put the length of thisFigure into L
>>
>>if L > 15 then put "," before char -15 of thisFigure -- THIS WOULD BE AT 
>>LEAST 1 TRILLION!!
>>
>>put "$" before thisFigure
>>
>>end commaInsert
>>
>>
>>
>>I use the above function (command) after performing math functions on 
>>numbers that I then want to display as dollar amounts with the commas in 
>>the right places.
>>It would be very cool to have it available all the time through a plug-in. 
>>It would be even more cool if I could somehow add it to the LC dictionary 
>>and do this:
>>
>>put commaInsert(thisFigure) into field "myDollarDisplay"
>>if thisFigure < 1 then set the textcolor of field "myDollarDisplay" to red
>>
>>Or even:
>>put commaInsert(thisFigure + otherFigure) into [container]
>>
>>From what I've heard from programming friends, other languages allow for 
>>adding of functions to the dictionary as in the two line example in 
>>italics above.
>>
>>Do you know if that is possible in LC?  As far as I know, it is not 
>>possible.
>>Larry
>>
>>----- Original Message -----
>>From: <dunbarx at aol.com>
>>To: <use-livecode at lists.runrev.com>
>>Sent: Sunday, October 12, 2014 4:53 PM
>>Subject: Re: problem with counting words
>>
>>
>>>
>>>
>>>  Larry.
>>>  But you can make your own "dictionary". Without limit. Most of that, 
>>> too, has been possible since Hypercard. You can define your own 
>>> properties, commands and functions, and place them in permanent use in 
>>> several ways, for example, as a library stack in use or a plug-in.
>>>  Have you ever written such a thing? Please write back if you have not, 
>>> and we will play around for a while. Or if you have written such 
>>> gadgetry, but just never saved any of them for later, general use in 
>>> your own personal LC world, the tell us that as well.
>>>  Craig Newman
>>>
>>>  _______________________________________________
>>>  use-livecode mailing list
>>>  use-livecode at lists.runrev.com
>>>  Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>>  http://lists.runrev.com/mailman/listinfo/use-livecode
>>_______________________________________________
>>use-livecode mailing list
>>use-livecode at lists.runrev.com
>>Please visit this url to subscribe, unsubscribe and manage your 
>>subscription preferences:
>>http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 





More information about the use-livecode mailing list