<p>Hi Remi,</p>
<p>On 16/08/14 16:19, Rémi Denis-Courmont wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> vlc | branch: master | Rémi Denis-Courmont <remi@remlab.net> | Sun Aug 14 17:18:49 2016 +0300| [520b13a2ca88fc63ba3c1287e9314fbb2777c85d] | committer: Rémi Denis-Courmont

 lua: use luaL_checkint() where applicable</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<h3 id="httpgit.videolan.orggitweb.cgivlc.gitacommith520b13a2ca88fc63ba3c1287e9314fbb2777c85d">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=520b13a2ca88fc63ba3c1287e9314fbb2777c85d</h3>
</blockquote>
<pre><code>  modules/lua/demux.c         |  4 ++--
  modules/lua/libs/dialog.c   | 14 +++++++-------
  modules/lua/libs/net.c      | 16 ++++++++--------
  modules/lua/libs/osd.c      |  4 ++--
  modules/lua/libs/playlist.c | 10 +++++-----
  modules/lua/libs/stream.c   |  2 +-
  modules/lua/libs/volume.c   |  2 +-
  7 files changed, 26 insertions(+), 26 deletions(-)</code></pre>
</blockquote>
<p>The precense of <code>luaL_checkint</code> is conditionally enabled only if <code>LUA_COMPAT_APIINTCASTS</code> is defined for <em>lua</em> versions <code>>= 5.3.0</code>; as such these changes breaks builds on system that have such version present.</p>
<p>See the below for more information.</p>
<ul>
<li>http://www.lua.org/manual/5.3/manual.html#8.3</li>
</ul>
<hr style="height:1px;margin-bottom:20px;background-color:#ddd;color:#ddd" />
<h3 id="earlier-in-the-log">Earlier in the log</h3>
<p>Usage of <code>luaL_checkint</code> was replaced with <code>luaL_checkinteger</code> in the past by the changes in the below linked commit:</p>
<ul>
<li>http://git.videolan.org/?p=vlc.git;a=commit;h=2468da5</li>
</ul>
<p>Looking earlier in the log, <code>LUA_COMPAT_APIINTCASTS</code> was defined by the below (but effectivelly removed by <code>2468da5</code>):</p>
<ul>
<li>http://git.videolan.org/?p=vlc.git;a=ocmmit;h=41caaa08</li>
</ul>
<hr style="height:1px;margin-bottom:20px;background-color:#ddd;color:#ddd" />
<h3 id="question">Question</h3>
<ul>
<li><p>Why was it decided to effectively roll back the changes introduced by <code>2468da5</code> while not taking <code>41caaa08</code> into account?</p></li>
<li><p>Is it a concious decision to not support<code>lua >= 5.3.0</code>?</p></li>
</ul>
<hr style="height:1px;margin-bottom:20px;background-color:#ddd;color:#ddd" />
<h3 id="my-thoughts">My thoughts</h3>
<p>If we want to use <code>luaL_checkint</code> while still supporting <code>lua >= 5.3.0</code> we should <code>#define LUA_COMPAT_APIINTCASTS</code> in <code>modules/lua/vlc.h</code> in order to successfully build the relevant code on the affected versions.</p>
<p>Though, given that the function is effectively deprecated in later versions, it certainly (imo) makes more sense to introduce a helper function (since such seems to be lacking in the lua api), that checks whether or not the <code>lua_Integer</code> fits inside <code>int</code>, and if it does returns a value of type <code>int</code> (otherwise errors).</p>
<p>Best Regards,<br />
Filip Roséen</p>