我想在SQL请求中传递不同函数中的变量,如下所述:
popup = display.newImage( "interface/popup-1.png")
popup.width=568
popup.height=232
popup.anchorX=0.5
popup.anchorY=0.5
popup.isVisible=false
popup.y=-700
popup:addEventListener( 'tap', displaySpeech)
popup.destination="mycharacter"
camera:add(popup,1,false)
这是我接受变量'字符'
的地方
function speak(event)
character = event.target.destination
displaySpeech(character)
end
num=1
function displaySpeech(character)
displaySpeech_get(""..num.."",character)
num=num+1
end
function displaySpeech_get(number,character)
for row in db:nrows("SELECT * FROM speeches WHERE character='"..character.."' LIMIT "..tostring(number)..",1") do
myMessage.text=row.speech
end
end
第一个"回复"我的SQL请求服务,但一旦我第二次调用函数displaySpeech_get(数字,字符)它显示错误。我试图打印变量'字符',它得到一个表ID!
任何解决方案?