From 146960e05e180eba27d61d2e8f7a311736880e81 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 4 Feb 2012 21:54:09 +1000 Subject: Set variables to a proper value if otherwised unitialized. --- LuaSL/src/LuaSL_compile.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'LuaSL/src/LuaSL_compile.c') diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index a9375d9..f3fddef 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -2280,8 +2280,18 @@ static void outputIdentifierToken(FILE *file, outputMode mode, LSL_Leaf *content outputText(file, &(content->value.identifierValue->name), !(LSL_NOIGNORE & content->toKen->flags)); if (OM_LUA == mode) { - // TODO - should output a default value depending on type. - fprintf(file, " = nil"); + switch (content->basicType) + { + case OT_bool : fprintf(file, " = false"); break; + case OT_integer : fprintf(file, " = 0"); break; + case OT_float : fprintf(file, " = 0.0"); break; + case OT_key : fprintf(file, " = _LSL.NULL_KEY"); break; + case OT_list : fprintf(file, " = {}"); break; + case OT_rotation : fprintf(file, " = _LSL.ZERO_ROTATION"); break; + case OT_string : fprintf(file, " = \"\""); break; + case OT_vector : fprintf(file, " = _LSL.ZERO_VECTOR"); break; + default : fprintf(file, " = nil"); break; + } } } else -- cgit v1.1