I'm study Linear Relationships in mathamatics, I came across the formatting of the table used to provide the positioning of each value of the Graph, Looking something like this...
Table[i] | Table[v]
1 3.50 2. 7.00 3. 10.50 4. 14.00 5. 17.50
For those who don't understand how liner equations work, they're simply a calculated line drawn on a positive to negative XY Graph, it takes the variable, usually a number. Multiplies it by how many times called, Eg, Table[i] (How many variables exist by interval; 0-#?
) is 5. Table[v] is 3.50
, the rest is self explanatory with the formatting of the table above.
I decided to take a chance on creating a complicated-ish algorithm on how to present the Graph through Console, here's what I've done. This is the formula table_[i]*variable
I am getting nothing, but blank space, not even a hextag. I know the algorithm is quite messy and probably wrong as I wrote it literally a few minutes ago, and am too busy with midterms to figure out the issue(s), could anyone tell me?
local table_ = {'startkey'} local listlength, variable local chart = {} for i,_ in ipairs(table_) do listlength = 5; variable = 3.50 if (type(variable) ~= "number") then error("variable '"..variable.."' isn't an integer.") end table.remove(table_, 1) for i_ = listlength, listlength, 1 do if (#table_ ~= listlength) then table.insert(table_, tonumber(i_)) else break end; end; table.insert(chart, table_[i]*variable) end; for i = 1,#table_ do print(tostring(i)..[[ - ]]..table.concat(chart)) end;
Please don't mind the way I use ;
, I'm transferring from another language, it also doesn't entirely effect the Script at all so it doesn't matter.
Thanks!
local t = {}; local endNum = 5; local variable = 3.5; while (#t ~= endNum) do table.insert(t, #t * variable); end for i, v in ipairs(t) do print(i .. " - " .. v); end