Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State change in function #19

Open
RayZopf opened this issue Feb 26, 2016 · 0 comments
Open

State change in function #19

RayZopf opened this issue Feb 26, 2016 · 0 comments
Labels

Comments

@RayZopf
Copy link

RayZopf commented Feb 26, 2016

https://code.google.com/archive/p/lslforge/issues/30
Posted on Mar 11, 2013 by Happy Hippo
What steps will reproduce the problem? 1. Create a function that uses the 'conditional' hack to change states, like this:

bugstate() { if (TRUE) state otherState; }

What is the expected output? What do you see instead? Expected output: a warning about changing states in global functions. Observed: The error "state changes not allowed from this context" - LSLForge Problem This prevents the .lsl script from being assembled.

What version of the product are you using? On what operating system? Linux Mint

Please provide any additional information below.

Comment 1

Posted on Apr 17, 2014 by Swift Horse
LSL wiki says: User-defined (global) functions cannot change a script's state. The compiler will throw the error 'ERROR: Global functions can't change state'. Note: Previously, global functions could change state in the body of a simple 'if' statement; this "workaround" no longer works. (from http://wiki.secondlife.com/wiki/State) So it's not a issue.

Comment 2

Posted on Apr 17, 2014 by Happy Hippo
That wiki remark was added on 6 june 2010. I appears to me that in practice the LL wiki is not correct on this.

At the moment, april 2014, this 'hack' still works. Disabling it would break a lot of existing code, so it's unlikely LL will change this in the near future without explicit reason.

Comment 3

Posted on Apr 18, 2014 by Swift Horse
I remember it didn't work in beta grid before, but it seemed my misunderstanding. It worked today in main grid. And I found for, while and do while statement allow this hack. Are there any other cases? It's very strange to inhibit state changing in function, it's not a technical problem, but this is not a place discussing it. There are 3 points to fix it.

How LSLForge should work
How to change LSLForge compiler
How to change LSLForge debugger
For 1., we need to research all cases to allow state change in global functions. (It's a troublesome task to implement such a buggy spec.) For 2., I made some patches for LSLForge compiler but I don't understand to show warnings yet. And 3., I haven't read around LSLForge debugger yet, need some time to learn it.

I'm not sure when I can finish it, but not impossible. Wait for a while...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants