local wordSound = audio.loadSound("ratón.mp3")
audio.play(wordSound, {channel = 1})
… I get a resource not found error (but you can play the file ratón.mp3 in Quicktime OK, so it’s a valid OSX filename but what about iOS?).
The reason it may be a Lua issue is that if I do any string manipulation on “ratón” I run into problems. For example, Lua returns a string length of 7 character with the following byte codes (114, 97, 116, 111, 204, 129, 110). So the letter ó is represented by 3 bytes (111, 204, 129).
So is this a bug in Corona or a peculiarity of Lua? Either way is there a work around? [import]uid: 2646 topic_id: 8581 reply_id: 308581[/import]
local word = display.newText("", 0, 0, "Helvetica", 100)
spanishWord = "ratón"
word:setTextColor(0, 0, 255)
word.text = spanishWord
word.x = display.contentWidth/2
word.y = display.contentHeight/2
print(spanishWord, #spanishWord)
for i=1, #spanishWord do
print (string.byte(spanishWord, i), string.char(string.byte(spanishWord, i)))
end
print(string.char(236)) -- this is the code for letter ó (o acute)
local wordSound = audio.loadSound("ratón.mp3")
audio.play(wordSound, {channel = 1})
The word ‘ratón’ displays correctly on screen but the terminal output is …
This works:
[lua] spanishtext = “mamá”
spanishtextv2 = spanishtext:gsub( “á”, “a-tc” )
local wordSound = audio.loadSound(spanishtextv2…".wav")
audio.play(wordSound) – will play “mama-tc.wav”
print( spanishtextv2 )[/lua]
But I can’t make it work with tables:
[lua] spanishtextv2 = spanishtext:gsub(".",{a=“a-tc”}) --Works with a
spanishtextv2 = spanishtext:gsub(".",{á=“a-tc”}) --Doesn’t work with á[/lua]