aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL/LuaSL_compile.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-09-14 08:09:02 +1000
committerDavid Walter Seikel2014-09-14 08:09:02 +1000
commit6fb0ba8539b54642c96d8f0d45c3bf812a316ec7 (patch)
treed147a2f0deece02e9bd9e50673d9f62d34f939ff /src/LuaSL/LuaSL_compile.c
parentNow we can pass LSL scripts to LuaSL on the command line. Plus some white sp... (diff)
downloadSledjHamr-6fb0ba8539b54642c96d8f0d45c3bf812a316ec7.zip
SledjHamr-6fb0ba8539b54642c96d8f0d45c3bf812a316ec7.tar.gz
SledjHamr-6fb0ba8539b54642c96d8f0d45c3bf812a316ec7.tar.bz2
SledjHamr-6fb0ba8539b54642c96d8f0d45c3bf812a316ec7.tar.xz
Support LSL multi line strings.
Diffstat (limited to 'src/LuaSL/LuaSL_compile.c')
-rw-r--r--src/LuaSL/LuaSL_compile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c
index 9d6834d..ecc61bd 100644
--- a/src/LuaSL/LuaSL_compile.c
+++ b/src/LuaSL/LuaSL_compile.c
@@ -105,6 +105,7 @@ LSL_Token LSL_Tokens[] =
105 {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken}, 105 {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken},
106 {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken}, 106 {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken},
107 {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken}, 107 {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken},
108 {LSL_MSTRING, ST_NONE, "string", LSL_NONE, outputStringToken},
108 {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken}, 109 {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken},
109 {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken}, 110 {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken},
110 111
@@ -2184,7 +2185,15 @@ static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content)
2184static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content) 2185static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content)
2185{ 2186{
2186 if (content) 2187 if (content)
2187 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already. 2188 {
2189 if (MF_MSTRING & content->flags)
2190 {
2191 // TODO - LSL might ignore leading spaces in later lines, but does Lua?
2192 fprintf(file, "[=[%.*s]=]", (int) strlen(content->value.stringValue) - 2, &content->value.stringValue[1]);
2193 }
2194 else
2195 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already.
2196 }
2188} 2197}
2189 2198
2190boolean compilerSetup(gameGlobals *ourGlobals) 2199boolean compilerSetup(gameGlobals *ourGlobals)