aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--LuaSL/Test sim/objects/onefang's test bed/~menucfg.lsl4
-rw-r--r--LuaSL/src/LuaSL_compile.c35
2 files changed, 38 insertions, 1 deletions
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~menucfg.lsl b/LuaSL/Test sim/objects/onefang's test bed/~menucfg.lsl
index d38843d..a258fb8 100644
--- a/LuaSL/Test sim/objects/onefang's test bed/~menucfg.lsl
+++ b/LuaSL/Test sim/objects/onefang's test bed/~menucfg.lsl
@@ -254,10 +254,12 @@ state load {
254 254
255 integer ix; 255 integer ix;
256 integer count; 256 integer count;
257 while ((ix = myListFind(buttons, "-")) != -1) { 257 ix = myListFind(buttons, "-");
258 while (ix != -1) {
258 ++count; 259 ++count;
259 buttons = llDeleteSubList(buttons, ix, ix); 260 buttons = llDeleteSubList(buttons, ix, ix);
260 commands = llDeleteSubList(commands, ix, ix); 261 commands = llDeleteSubList(commands, ix, ix);
262 ix = myListFind(buttons, "-");
261 } 263 }
262 if (count) { 264 if (count) {
263 for (ix = 1; ix < llGetListLength(buttonindex); ++ix) { 265 for (ix = 1; ix < llGetListLength(buttonindex); ++ix) {
diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c
index e9a22c1..8194947 100644
--- a/LuaSL/src/LuaSL_compile.c
+++ b/LuaSL/src/LuaSL_compile.c
@@ -1,5 +1,40 @@
1#include "LuaSL.h" 1#include "LuaSL.h"
2 2
3/* TODO -
4
5Assignments in the middle of expressions is legal in LSL, but not in Lua.
6The big complication is that they often happen in the conditionals of flow control statements. That's a big bitch.
7
8So things like -
9
10 while ((x = doSomething()) == foo)
11 {
12 buggerAround();
13 }
14
15Turns into -
16
17 x = doSomething();
18 while (x == foo)
19 {
20 buggerAround();
21 x = doSomething();
22 }
23
24http://lua-users.org/wiki/StatementsInExpressions might be helpful. Which suggests something like this -
25
26 while ( (function() x = doSomething(); return x; end)() == foo)
27 {
28 buggerAround();
29 }
30
31The remaining problem is when to recognise the need to do that.
32Note that assignments are really low precedence.
33 While adding operations
34 Flag the assignment expressions
35 If there is an assignment expression (not operation) on the RHS of an operation, we need to do this?
36*/
37
3 38
4static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); 39static LSL_Leaf *evaluateFloatToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right);
5static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right); 40static LSL_Leaf *evaluateIntegerToken(LSL_Leaf *content, LSL_Leaf *left, LSL_Leaf *right);