wiremod/wire

Vector2 issue

Closed this issue · 4 comments

Hrecha commented

self.GlobalScope.vclk[this] = true

code on E2:

MaxRanges[DataInd] = round(DataMaxRng/39.37, 1)

will cause this:

sv: Expression 2 (CFCS v0.9.9 (HUD)): Internal error 'entities/gmod_wire_expression2/core/vector2.lua:658: attempt to index global 'self' (a nil value)' at line 464, char 13

I fix this problem, edited:
vector2.lua:658
self.GlobalScope.vclk[this] = true
change "self" to "state"
state.GlobalScope.vclk[this] = true

upper on 139 row, used "state" and in example how to use, showed from #2555
image

Vurv78 commented

May I ask why you're using vector4? Just curious. Because the plan was to deprecate it since it is essentially just an array.

Hrecha commented

in fact, this is not my code, someone's chip was written and it was convenient for him to use vector4 as an array
in the future, I will help him and write another code, but now he is faced with a problem and asked to see what is wrong, since he does not have much experience in programming, we tried to test what exactly is wrong, well, I concluded that the problem lies in the code of the "wire" itself

Hrecha commented

and so I myself often use it when creating holos, setting the color and transparency, rgba like

Vurv78 commented

Yeah it would be deprecated and replaced with a proper color type.