From 6b097d337444a0e02efc6cebed08a860d2e435ed Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 4 Feb 2012 22:47:37 +1000 Subject: Implement typecasts when needed. Actually, doing some extras for the moment. --- LuaSL/src/LSL.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'LuaSL/src/LSL.lua') diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index cc9b454..1e7cc13 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua @@ -311,6 +311,38 @@ function LSL.stateChange(x) end end; +function LSL.floatTypecast(x) + local temp = tonumber(x) + if nil == temp then temp = 0 end + return temp; +end + +function LSL.integerTypecast(x) + local temp = tonumber(x) + if nil == temp then temp = 0 end + return temp; +end + +function LSL.keyTypecast(x) + return "" .. x; +end + +function LSL.listTypecast(x) + return {x}; +end + +function LSL.rotationTypecast(x) + return x; +end + +function LSL.stringTypecast(x) + return "" .. x; +end + +function LSL.vectorTypecast(x) + return x; +end + return LSL; -- cgit v1.1