From e287600e26b49d43b0c98b74c615944ea4570e11 Mon Sep 17 00:00:00 2001 From: Ayane Satomi Date: Sat, 30 Apr 2022 21:43:43 +0800 Subject: [PATCH] Simplify DECTalk conditional Signed-off-by: Ayane Satomi --- starfallex/starfall-ttslib.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/starfallex/starfall-ttslib.lua b/starfallex/starfall-ttslib.lua index 1dbb0c2..0106747 100644 --- a/starfallex/starfall-ttslib.lua +++ b/starfallex/starfall-ttslib.lua @@ -30,7 +30,7 @@ function itExists(table, val) end end -function speak(ent, txt, remote, variant) +function TTSLib:speak(ent, txt, remote, variant) if not itExists(remoteList, remote) then print(remote .. " Does not exist in this context") else @@ -40,7 +40,7 @@ function speak(ent, txt, remote, variant) if not itExists(sapi4Voices, variant) then print("Invalid voice argument, valid voices are: Sam, Mike, Mary") else - url = string.format(remoteList[1], voice) + url = string.format(remoteList[1], variant) end end @@ -48,17 +48,14 @@ function speak(ent, txt, remote, variant) if not itExists(googleVoices, variant) then print("Invalid voice argument, valid voices are: en, fr, jp") else - url = string.format(remoteList[2], variant, txt) + url = string.format(remoteList[2], variant) end end if remote == "dectalk" then - if variant ~= nil then - print("Warning: DECTalk does not have arguments, ignoring.") - url = remote[3] - else - url = remote[3] - end + -- Ignore arguments here + -- DECTalk only has one variant + url = remote[3] end http.get(url .. http.urlEncode(text), function(code, body)