LiveCode scripting

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
UKenGB
Posts: 16
Joined: Mon Aug 25, 2014 11:06 am

LiveCode scripting

Post by UKenGB » Wed Feb 21, 2018 4:20 pm

This came about when installing and figuring out LiveCode Server for CGI use.

I read an install guide that suggested trying a basic file from the command line just to check it was working. The file would contain the LC code within <?lc and ?> tags. Having figured out how to get line endings that worked on a Mac, I was able to pass the script file to the LiveCode Server executable and get the expected output. I then had an idea and tried the following:-

Code: Select all

#!/usr/local/bin/livecode-server
set the outputLineEndings to "lf"
put "Hello World!" & return & the date && the time & return
The first line being the standard way to specify the program file to be used to interpret the code contained in the rest of the file. The second line is what I needed to get proper returns on the Mac and then there's the actual LC code to run. Note, it is NOT between any special tags.

Make this script file executable and run it. This actually works perfectly and I think is a really handy way to be able to use LiveCode for testing and even general scripting purposes.

Now if this has all been done before and is now old hat, I apologise. Otherwise, I think it's pretty cool. :)

Post Reply

Return to “CGIs and the Server”