Sunday, September 20, 2015

Larger Livecode Projects


This tutorial is written for LiveCode 6.6.2 stable and may not work with other releases. This document will not be updated.

Distributing work to different developers

When working in larger teams you might want to distribute work to different developers. If you have only one stack file then you'll encounter the problem that the stackfile will be locked by one developer and during that time the other developers can't work on the stack.

A solution for this issue is to let the developers develop their own stacks for the functionality they have to provide. They build their own functional stacks which will be then glued together as substacks in to one main stack.

It is possible to glue together stacks through the stackFiles property. In the below example i've created following files:

  • mainstack.livecode
  • parts/part1.livecode
  • parts/part2.livecode

In part1.livecode I've added following command:

on part1HelloWorld
  answer "Part1: Hello World"
end part1HelloWorld

In part2.livecode I've added following command:

on part2HelloWorld
  answer "Part2: Hello World"
end part2HelloWorld

Then I've written following code to load the stacks in to the mainstack.livecode file:

on preOpenStack
   local tStackFiles
   put "part1,parts/part1.livecode" & cr into tStackFiles
   put "part2,parts/part2.livecode" after tStackFiles
   set the stackFiles of this stack to tStackFiles
end preOpenStack

on openStack
   start using stack "part1"
   start using stack "part2"
end openStack

As you can see above you'll have to load each stack with the short name of the stack, a comma and the path relative to the main stack. "the stackFiles" requires that you load each stack on a single line.

If you need the substacks to interact with each other you can define global variables that can be set or you can define commands or functions that can be executed in each part that can be executed globally. You should be able to execute all commands and functions as long they were not specified as "private".

No comments:

Post a Comment