News for hackers. Stuff that matters.
Re:Lua: Good, Bad, and Ugly Parts (2012) by BoogerDan on Monday December 27, 2021 @07:45AM (#29702052)
Lua appeals to my sensibilites and I want to make use of it. It seems to be a well-designed language and it has a very performant JIT. But a big weakness for non-embedded use cases seems to be its ecosystem. A recent little project I wanted to use Lua on included a sqlite database, oldschool 3DES encryption, and an SMTP client. For many languages, there would be a clearly mob-approved library for each of these. But I found 3 or 4 possibilities to use sqlite in Lua, with no clear winner. I ended up using Ruby instead.
Re:Lua: Good, Bad, and Ugly Parts (2012) by strenholme on Monday December 27, 2021 @09:21AM (#29702677)
While what you went through and felt is valid, I was able to find, in LuaRocks, libraries or Lua interfaces to libraries implementing everything on that wish list. In more detail:

a sqlite database

https://luarocks.org/modules/tami5/sqlite

https://luarocks.org/modules/dougcurrie/lsqlite3

3DES encryption

https://luarocks.org/modules/starius/luacrypto

https://github.com/somesocks/lua-lockbox/blob/master/lockbox...

an SMTP client

https://luarocks.org/modules/luarocks/lua-smtps

Re:Lua: Good, Bad, and Ugly Parts (2012) by astrobe_ on Monday December 27, 2021 @02:57PM (#29706144)
In my limited experience, when you want to interact with C libraries, you often end up reading the docs of the original C library anyway because often the bindings are nearly 1:1 - and often the trouble lies in the word "nearly".

Just writing yourself the bindings you actually need is most likely the best approach.

It should be relatively easy to do, because by using something like Lua you goal is precisely to expose functionalities implemented by your language as Lua functions (otherwise you would just convert them into dynamic library functions and use a classic glue language with a decent FFI to connect them).

This is the value proposition of an embeddable scripting language at heart.