Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Method that sets a boolean in self crashes when played?

Asked by 6 years ago

Hi,

I've been working freelance on new opensource technology for war clans to use; however, I've also stumbled upon problems while trying to instill new habits in myself. I attempted playing around with methods for compact code and more dynamic tables, but every-time I hit play-test using the code below server-side, it crashes.

01local terminal = {
02    Safe = false;
03 
04    Stability = 1000, -- time before win
05    Rollback = 2;
06 
07    ServerElapsed = 3600;
08    ------------
09    StatusChange = function(self, planted)
10        self.Safe = (not planted)
11 
12        while (self.Safe == (not planted) and wait()) do
13            self.Stability = (self.Stability < 1000 and self.Stability + (self.Safe and self.Rollback or -1))
14            print('Timer:', self.Stability)
15            if (self.ServerElapsed <= 0 or self.Stability <= 1000) then
View all 26 lines...

I've narrowed it down to this line right here:

1self.Secure = (not planted)

So does this mean I can't set previous values in a table through a method? I'm really confused and would appreciate help!

0
Why are you wrapping lines 10, 12-13, 15, and 22 wrapped in brackets? User#19524 175 — 6y
0
Just a habit. Is that a concern? HollowMariofan 104 — 6y

Answer this question