Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea, require, and custom C libraries

em2em2
in Questions Posts: 194

I peeked around Codea's .ipa file and found several libraries of interest that can be required and loaded but are undocumented, like "socket.lua". This raises two questions for me:
1. Are these hidden files (re.lua, LuaSandbox.lua) useful and is there documentation somewhere for them?
2. Is it possible to modify these files or add some of your own, e.g. luarocks, etc?

Comments

  • dave1707dave1707 Mod
    edited October 2018 Posts: 7,533

    You can do a forum search because some of them have been used already. What all did you find.

  • em2em2
    Posts: 194

    The files I found were

    • ClassTemplate.lua
    • dkjson.lua
    • ftp.lua
    • headers.lua
    • http.lua
    • ltn12.lua
    • LuaSandbox.lua
    • mbox.lua
    • mime.lua
    • re.lua
    • smtp.lua
    • socket.lua (already knew about this one)
    • tp.lua
    • tween.lua
    • url.lua
    • "lpeg" a library that can be included but isn't in the files

    I found them by downloading Codea's IPA file from iTunes, then unzipping it.

  • em2em2
    edited October 2018 Posts: 194

    On a jailbroken iPad, I tried installing a custom lua module, lfs, but requiring it failed with the error: error loading module 'lfs' from file /usr/local/lib/lua/5.3/lfs.so

  • edited October 2018 Posts: 494

    Including libraries that aren't written in pure Lua is another story... The Lua-File-System is such a thing! It must be compiled from source for the specific target platform that you will use it in (iOS in your case). That's were things get complicated because afaik iOS doesn't like 'dynamic linking' so sources must be compiled as 'static libraries'. After compilation you must copy the resulting *.dylib file (I think it's a dylib file extension) and the Lua interface files (additional *.lua files similar to what the socket library has) into your project. Then you can use it. – But I'm afraid that I'm not qualified to tell you how to do this. However Google might help.

  • em2em2
    Posts: 194
    @se24vad I already gave up on trying to compile libs for Lua :/ maybe @Simeon or @John can elaborate their process...
Sign In or Register to comment.