Lua string with quotes

Moderator: leecollings

Post Reply
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Lua string with quotes

Post by remb0 »

I'm busy with my alarm script and want is as modular as possible, so I made a function:

Code: Select all

function My.PlaySound(msg)
    Debug='Y'
    if (Debug == 'Y') then print('>> Alarm speaks: '.. msg)     end
    os.execute ("sudo killall mplayer")
    os.execute ('sh /home/pi/domoticz/scripts/bash/Play_sound.sh' .. msg)
end
the Play_Sound script expects a parameter.. But I can't get msg as a variable.
I changed a lot with quotes etc, but don't get it working. the closes i got is that my speaker says" dotdot of M S G.
not the sentence in the variable msg.

What am I doing wrong?
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Lua string with quotes

Post by remb0 »

found it!!!

os.execute ("sh /home/pi/domoticz/scripts/bash/Play_sound.sh '" .. msg .. "' ")
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest