The easiest way to do it would be to convert soda to a string and then get each place value as a substring like Diarandor suggests.
For example:
local soda = 9478
local soda_string = string.format("%04d", soda) --soda_string = "9478"
local soda_split = {}
for i = 0,3 do
local index = soda_string:len()-i
local num = tonumber(soda_string:sub(index,index))
table.insert(soda_split, num)
end
--soda_split[1] = 8
--soda_split[2] = 7
--soda_split[3] = 4
--soda_split[4] = 9
The "%04d" adds leading zeroes to the number converted to a string, so 1 becomes "0001" and 12345 becomes"12345". That ensures you'll get a value of zero rather than nil if soda is less than 4 digits.