From 0626bc79168a4735df9083be616efb05bb106de6 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 4 Feb 2012 21:52:48 +1000 Subject: Cooment a problem with typecasting strings to integers. --- LuaSL/src/LuaSL_compile.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index d73b145..a9375d9 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -1,5 +1,23 @@ #include "LuaSL.h" +/* TODO - +Bit of a problem, but I think it will go away once llGetSubString() is implemented. +The problem is that Lua can't convert the string "0x" to a number, though it's fine with "0x0". +In LSL any string that does not represent a number gets converted to 0 by a typecast. + +In other cases the LSL code is typecasting a string to an integer, but Lua can't coz it's not a real number in the string. + +Sooo, should actually implement that typecast. + +function --[[integer]] channel() + return --[[(integer)]] ("0x" .. _LSL.llGetSubString( --[[(string)]] _LSL.llGetKey(), -4, -1)); +end + +function setBalls( --[[string]] cmd) + local --[[integer]] ch=channel(); + _LSL.llSay(ch+ix, cmd); +end +*/ static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); -- cgit v1.1