<div dir="ltr">Hello guys,<div><br></div><div>I'm trying to iterate over an htable in lus, this is what i have:</div><div><br></div><div>===================================</div><div><font face="monospace">loadmodule "app_lua.so"<br>modparam("app_lua", "load", "/etc/kamailio/myscript.lua")<br>modparam("htable", "htable", "mydata=>size=16;autoexpire=0;dbtable=mydata;dbmode=0;")<br><br>route {<br>    lua_run("match_mydata");<br>}<br><br>...<br><br>function match_</font><span style="font-family:monospace">mydata</span><font face="monospace">(</font><font face="monospace">)<br>    KSR.htable.sht_iterator_start("i1", "</font><span style="font-family:monospace">mydata</span><font face="monospace">")<br>    while KSR.htable.sht_iterator_next("i1")<br>    do<br>        KSR.log("err","WHILE: iterating on: " .. KSR.htable.sht_get("</font><span style="font-family:monospace">mydata</span><font face="monospace">", "i1"))<br>    end<br>    KSR.htable.sht_iterator_end("i1");<br>end</font><br></div><div><br></div><div><br></div><div>But i keep getting:</div><div><br></div><div><font face="monospace">0(1255) DEBUG: app_lua [app_lua_api.c:666]: app_lua_run_ex(): executing Lua function: [[match_mydata]]<br>0(1255) DEBUG: app_lua [app_lua_api.c:668]: app_lua_run_ex(): lua top index is: 12<br>0(1255) ERROR: app_lua [app_lua_api.c:719]: app_lua_run_ex(): error from Lua: /etc/kamailio/myscript.lua:11: attempt to call field 'sht_iterator_start' (a nil value)<br>0(1255) ERROR: app_lua [app_lua_api.c:734]: app_lua_run_ex(): error executing: match_mydata (err: 2)</font><br></div><div><br></div><div>This almost exact same thing works on the cfg:</div><div><br></div><div><font face="monospace">    sht_iterator_start("i1", "msrn");<br>    while(sht_iterator_next("i1")) {<br>        xlog("data: $shtitkey(i1)\n");<br>    }<br>    sht_iterator_end("i1");</font><br></div><div><br></div><div>Anyone know what I could be doing wrong?</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div>