Thanks Daniel<br><br><div class="gmail_quote">On Thu, Mar 29, 2012 at 2:49 PM, Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<div class="im"><br>
<br>
On 3/29/12 11:49 AM, Javier Gallart wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello all<br>
<br>
I&#39;m starting to play with lua scripting in Kamailio. It&#39;s really cool, some complex stuff in the script becomes really easy this way. The script is becoming quite big, therefore I&#39;d like to use lua_run instead of lua_dofile. My doubt is pretty  basic: if i load a script in memory at startup via the &quot;load&quot; parameter and the script is modifed afterwards, is there any way to reload the module so the script is reread?<br>

</blockquote></div>
the two contexts created by app_lua were designed one for loading at startup and the other for reloading every time. Reloading on demand at runtime is not possible. I thought of checking the timestamp of the script, but can be a bit risky if saving on intermediary state during updates. The scripts are loaded in each process, sending a mi/rpc command will require to do some inter-process signaling. Both doable, not in my short term plans, though, if someone is contributing, will be appreciated.<br>
</blockquote><div>Understood, we may give it a try in the next weeks. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Some options for speed up with existing code:<br>
- you can compile the Lua scripts, so reloading it each time will be faster (no more compile on-the-fly)<br></blockquote><div>I agree it&#39;s the most logical approach.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

- not sure about this one: in your script loaded at startup you may have some logic to load another script based on your rules (e.g., file timestamp, periodically, ...)<br></blockquote><div>Not sure either, will try.</div>
<div><br></div><div>What about using luajit? </div><div><br></div><div>Regards</div><div><br></div><div>Javi</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Daniel<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Daniel-Constantin Mierla<br>
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany<br>
<a href="http://www.asipto.com/index.php/kamailio-advanced-training/" target="_blank">http://www.asipto.com/index.<u></u>php/kamailio-advanced-<u></u>training/</a><br>
<br>
</font></span></blockquote></div><br>