function Initialize()
Equation = SKIN:GetVariable('Equation')
Solveable = 1
Coefficients = {}
Numbers = {}
Check = {}
k=0
for i=1,#Equation do
Coefficients[i] = '0'
end
for i=1,#Equation do
Coefficients[i] = string.sub(Equation, i, i)
end
for i=1,#Equation do
Numbers[i] = ''
end
for i=1,#Equation do
Check[i] = '0'
end
i=1
repeat
Check[i] = Coefficients[i]
Numbers[1] = Numbers[1]..Check[i]
i = i+1
until (tonumber(Check[i]) >= 10 or tonumber(Check[i]) < 0) or Check[i] == 'x'
Any help is much appreciated!
Last edited by revolt4peace on February 17th, 2015, 7:16 pm, edited 1 time in total.
-__--__-- Explodingcreeperssss --__--__- Click Me! - My Algebra Solver for Rainmeter!
until tonumber(Check[i]) >= 10 or tonumber(Check[i]) < 0 or Check[i] == 'x'
and that it may have something to do with the possibility that Check may not be a string (or is it char?) that I thought it was. Possibly. Another possibility is that I'm doing something else wrong in that line...
Please help!
-__--__-- Explodingcreeperssss --__--__- Click Me! - My Algebra Solver for Rainmeter!
In your original repeat .. until cycle, on the until check, Check is always equal with '0', because when you have certain value for i (and Check gets the value of Coefficients) after the assignement of Check and Numbers[1], the value of i increments, so the until condition is checked with this new value. So, on the until line Check is always equal with '0', the condition won't never be true and that's why the cycle never ends.
To avoid it, I'd move the assigning of Check array outside of the repeat .. until cycle: