Answer the question
In order to leave comments, you need to log in
Why is the variable defined as a string?
When calling a function, I get the error "attempt to call a string value".
If I pass a value to it like this,
t={1, 2, 3}
then there is no error,
but if I pass the value through processing the string with the
s="1,2,3"
function
function toarray(s)
local t = {}
s:gsub('%-?%d+', function(n) t[#t+1] = tonumber(n) end).
return t
end
t=toarray(s)
Answer the question
In order to leave comments, you need to log in
Most likely confused with global variables. Use local everywhere.
Try to debug this piece of code in the online interpreter.
https://repl.it/repls/CornsilkMemorableLanserver
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question