<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<br><div><br></div><div>I have the following function that works normally on lua, but when I copied and pasted it into my freeswitch lua script, the file wont open.  I am trying to put the passwords I use in a json format outside the script, so that I can share the script.  I have installed the correct libraries for lunajson to work.  </div><div>Any suggestions?</div><div><br></div><div><br></div><div><div>--Reads json file and parses it</div><div>function returnJson(option)</div><div>    freeswitch.consoleLog("INFO", "Inside function\n")<br></div><div><br></div><div>    local file = io.open("password.json", "r")</div><div>    if not file then </div><div>      return nil</div><div>    end</div><div>    local jsonString = file:read("*a")</div><div>    </div><div>    freeswitch.consoleLog("INFO", "File is open\n")</div><div>    file:close()</div><div>    jsonResult = lunajson.decode( jsonString )</div><div>    freeswitch.consoleLog("INFO", "Parsing json\n")</div><div>    return ( jsonResult[option] )</div><div>end<br></div><div><br></div><div>--SID = returnJson("SID")</div><div>--Token = returnJson("TOKEN")</div></div><div>------------------------------------------------------------------------------------------------------------</div><div><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(202,51,35)"><span style="font-variant-ligatures:no-common-ligatures">2020-12-04 14:38:13.637108 [ERR] mod_lua.cpp:203 /usr/share/freeswitch/scripts/test.lua:67: attempt to concatenate global 'SID' (a nil value)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(202,51,35)"><span style="font-variant-ligatures:no-common-ligatures">stack traceback:</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(202,51,35)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>/usr/share/freeswitch/scripts/test.lua:67: in main chunk</span></p></div></div></div></div>