A Few Questions About Lua...

Discussion in '3DS - Homebrew Development and Emulators' started by Jack_Sparrow, Dec 19, 2015.

  1. Jack_Sparrow
    OP

    Jack_Sparrow Ruthless Pirate

    Banned
    855
    477
    Nov 17, 2015
    United States
    The Black Pearl
    Can you compile your Lua code as a .3dsx or do you have to run it through an interpreter?
    Is your lua code the base of that interpreter or do you choose code from a GUI?
    Can lua code still access wifi and stuff, what are the limitations it has?
     
  2. Jwiz33

    Jwiz33

    Banned
    2,654
    1,523
    Jun 5, 2014
    United States
    in the illuminati headquar—I have said too much!
    You can include the index.lua in the .3dsx, CHMM does it.
    Yes.
    Yes. One limitation is that you are limited to the modules provided.
     
  3. Jack_Sparrow
    OP

    Jack_Sparrow Ruthless Pirate

    Banned
    855
    477
    Nov 17, 2015
    United States
    The Black Pearl
    So i could compile an index.lua with the interpreter as a .3dsx?
     
  4. MasterFeizz

    MasterFeizz GBAtemp Advanced Fan

    Member
    888
    826
    Oct 15, 2015
    United States
    Lua is interpreted language, limitations depend on how it's implemented. Lpp is the best lua "player" for the 3ds right now and has most things you will need. You can compile lua into bytecode and pack it into the 3dsx but I dont know if lpp has this feature.

    Edit: if you are worried about limitations, use C/C++
     
    Last edited by MasterFeizz, Dec 19, 2015
  5. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    3,127
    3,260
    Nov 24, 2014
    Italy
    Bologna
    You can include your LUA files and even your images in your 3dsx with lpp-3ds but you'll need to recompile it by scratch and make some modification to the code.

    CHMM2 for example uses embedded LUA script, image assets and TTF font.
    For the LUA script for example, this is the LUA file:
    https://github.com/Rinnegatamante/CHMM2/blob/master/source/index.lua

    Which is converted in an header file with bin2c: https://github.com/Rinnegatamante/CHMM2/blob/master/build.bat#L1

    And then loaded at interpreter startup instead of searching it on the SD: https://github.com/Rinnegatamante/CHMM2/blob/master/source/main.cpp#L119