Using substacks as libraries

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
tpflueger
Posts: 4
Joined: Thu Mar 31, 2016 4:00 am

Using substacks as libraries

Post by tpflueger » Thu Mar 31, 2016 4:05 am

I've been struggling with trying to pull other open source code such as fastjson but keep running into issues calling the handlers.

I created a substack "fastjson" and put the code as directed. Within the stack script within preOpenStack, I specified start using stack "fastjson" but whenever I try to call the functions from cards within the main stack I get issues.

I've looked and seen multiple examples but hoping someone could show me an example or if there is a better way of creating libraries to include for other stacks/cards.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Using substacks as libraries

Post by FourthWorld » Thu Mar 31, 2016 4:11 am

What specific issues do you get?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tpflueger
Posts: 4
Joined: Thu Mar 31, 2016 4:00 am

Re: Using substacks as libraries

Post by tpflueger » Thu Mar 31, 2016 4:12 am

I use the stack within the card script, and then within a button click I call jsonToArray.

button "Button": execution error at line 2 (Handler: can't find handler) near "jsonToArray", char 1

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Using substacks as libraries

Post by FourthWorld » Thu Mar 31, 2016 5:21 am

Run this in the Message Box and see if the stack in there (and spelled as expected):

Code: Select all

put the stacksInUse
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tpflueger
Posts: 4
Joined: Thu Mar 31, 2016 4:00 am

Re: Using substacks as libraries

Post by tpflueger » Thu Mar 31, 2016 5:38 am

Trying stacksInUse is empty, but if I do libraries it shows the one I want.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Using substacks as libraries

Post by FourthWorld » Thu Mar 31, 2016 5:52 am

That's weirder than I have words for. The stacksInUse produces a list of active libraries.

Well, at least in this dimension.

Where are you getting that library list?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tpflueger
Posts: 4
Joined: Thu Mar 31, 2016 4:00 am

Re: Using substacks as libraries

Post by tpflueger » Thu Mar 31, 2016 6:22 am

I'm sorry about that, I redid what you said and it worked this time because I capitalized it correctly. It also finally started working but not entirely sure what I did this time to get it to work...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Using substacks as libraries

Post by FourthWorld » Thu Mar 31, 2016 4:23 pm

tpflueger wrote:not entirely sure what I did this time to get it to work...
That's the magic of programming. :)

Image
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply