I’m currently writing a note script, which will create notes to allow players to play songs. However, I’m getting the error “table expected, got number”. Here is my code & table structure for reference:
local notes = songJSON[tostring("notes")]
local speed = songJSON[tostring("speed")]
for v,i in pairs(notes) do
for b,o in pairs(v) do -- error here
for n,p in pairs(b["sectionNotes"]) do
createNote(p[1], p[2], p[3], speed)
end
end
end
Table structure:
[1] = timing
[2] = direction
[3] = type(?)
Any idea why this is happening? I tried using ipairs, as well.
for i,v in pairs(notes) do
print(tostring(i)) -- prints 1
print(tostring(v)) -- prints table: 0xaf7aef1aa514c1fd
for b,o in pairs(v) do
for n,p in pairs(b["sectionNotes"]) do
createNote(p[1], p[2], p[3], speed)
end
end
end