cannot use loadSound function

hello guys, i have a problem with my app

this the snippet of my code

local function playsound (self , event) speech = audio.loadSound("audio/1.wav") speechChannel = audio.play( speech ) end

that function handle a touch of the button
but whenever i touch the button it has error like this on console

attempt to call field "loadSound" \< a nil value \> 

but if i use media.playEventSound(“audio/1.wav”) it work perfectly

so i really confuse now, why my loadSound function didn’t work :expressionless:

help me guys
thanks before [import]uid: 164509 topic_id: 33810 reply_id: 333810[/import]

How are you calling that function? Perhaps we need to see your button and how you are setting that up.

Also look to make sure you are not using “audio” as a variable somewhere and writing over the audio object. [import]uid: 199310 topic_id: 33810 reply_id: 134399[/import]

OMG i just realized that i used audio as a variable for button, maan i’m so dumb hahaha

thank you so much for the support [import]uid: 164509 topic_id: 33810 reply_id: 134448[/import]

How are you calling that function? Perhaps we need to see your button and how you are setting that up.

Also look to make sure you are not using “audio” as a variable somewhere and writing over the audio object. [import]uid: 199310 topic_id: 33810 reply_id: 134399[/import]

OMG i just realized that i used audio as a variable for button, maan i’m so dumb hahaha

thank you so much for the support [import]uid: 164509 topic_id: 33810 reply_id: 134448[/import]