aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/LSL.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua
index cdb560b..571ecf1 100644
--- a/lib/LSL.lua
+++ b/lib/LSL.lua
@@ -169,6 +169,7 @@ local function value2string(value, Type)
169 local temp = "" 169 local temp = ""
170 170
171 if "float" == Type then temp = temp .. value 171 if "float" == Type then temp = temp .. value
172-- elseif "boolean" == Type then if value then temp = '"true"' else temp = '"false"' end
172 elseif "integer" == Type then temp = temp .. value 173 elseif "integer" == Type then temp = temp .. value
173 elseif "key" == Type then temp = "\"" .. value .. "\"" 174 elseif "key" == Type then temp = "\"" .. value .. "\""
174 elseif "list" == Type then temp = "[" .. args2string(true, unpack(value)) .. "]" 175 elseif "list" == Type then temp = "[" .. args2string(true, unpack(value)) .. "]"
@@ -388,7 +389,8 @@ local constants =
388 newConst("integer", "TYPE_INVALID", 0), 389 newConst("integer", "TYPE_INVALID", 0),
389 390
390 newConst("string", "NULL_KEY", "00000000-0000-0000-0000-000000000000"), 391 newConst("string", "NULL_KEY", "00000000-0000-0000-0000-000000000000"),
391 newConst("string", "EOF", "\\n\\n\\n"), -- Corner case, dealt with later. 392-- newConst("string", "EOF", "\\n\\n\\n"), -- Corner case, dealt with later.
393 newConst("string", "EOF", "EndOfFuckingAround"), -- Corner case, dealt with later.
392 394
393 newConst("rotation", "ZERO_ROTATION", {x=0.0, y=0.0, z=0.0, s=1.0}), 395 newConst("rotation", "ZERO_ROTATION", {x=0.0, y=0.0, z=0.0, s=1.0}),
394 newConst("vector", "ZERO_VECTOR", {x=0.0, y=0.0, z=0.0}), 396 newConst("vector", "ZERO_VECTOR", {x=0.0, y=0.0, z=0.0}),
@@ -770,7 +772,8 @@ function LSL.mainLoop(sid, name, x)
770 772
771 SID = sid 773 SID = sid
772 scriptName = name 774 scriptName = name
773 LSL.EOF = "\n\n\n" -- Fix this up now. 775-- LSL.EOF = "\n\n\n" -- Fix this up now.
776 LSL.EOF = "EndOfFuckingAround" -- Fix this up now.
774 777
775 LSL.stateChange(x); 778 LSL.stateChange(x);
776 waitAndProcess(false) 779 waitAndProcess(false)
@@ -912,4 +915,15 @@ function LSL.listConcat(a, b)
912 return result; 915 return result;
913end 916end
914 917
918-- Lua really hates 0, it's not false, and it can't be a table index.
919function LSL.toBool(x)
920 local v = x
921 local t = type(v)
922 if 'boolean' == t then return v end
923 if 'number' == t then return (v ~= 0) end
924 if 'nil' == t then return false end
925 -- Is an empty string, empty list, zero vector/rotation false? Fucked if I know.
926 return true
927end
928
915return LSL; 929return LSL;