Why not just call into a C/other compiled language library in this case? It'll be faster and it's not like you're getting the advantages of Lua in this case because you're not actually integrating it. In the ideal case Lua likes to call into native functions to do the heavy lifting anyway.