[Question] How do i edit .lua files?

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by Monozombi, Feb 9, 2016.

  1. Monozombi
    OP

    Monozombi Newbie

    Newcomer
    4
    0
    Nov 16, 2015
    Argentina
    Hi, i'm trying to translate a game. I already decrypted the .3ds and have all the extracted files, but i don't know how to edit the text, as it's in .lua format (The .lua is the text, right?)
     
  2. VinsCool

    VinsCool Delusional

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,712
    27,756
    Jan 7, 2014
    Canada
    Another World
    You are in luck. LUA is a script used in the game.
    You may edit them with a text editor.


    Also, what is the game? So we know where you get started?
     
  3. Monozombi
    OP

    Monozombi Newbie

    Newcomer
    4
    0
    Nov 16, 2015
    Argentina
    Thanks, then i'll try using something like notepad++ . The game is Zero Escape: Virtue's Last Reward, i want to translate it to spanish.
     
  4. VinsCool

    VinsCool Delusional

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,712
    27,756
    Jan 7, 2014
    Canada
    Another World
    Oh I see.

    Well, uh, try to open the LUA files with notepad++, the might be something for sure.
     
  5. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,361
    9,153
    Nov 21, 2005
    lua is a programming language, I have seen it in a few DS games over the years and it makes sense that the 3ds would also support it.
    http://www.lua.org/docs.html has more. It is used in emulators aimed at speedrunning as well as being available in desmume and fceux and is not a bad programming language either, probably a bit less lucrative than python or ruby if you want a scripting language but as a general use thing is by no means bad.

    It tended to come in three main forms

    1) Some kind of binary shorthand, think java bytecode for a similar concept and possibly javascript minimisation. Puzzle Quest on the DS for this one.
    2) Some kind of standard compression and embedded archive formats. Handle like you would handle compression or archive formats normally. ( El Tigre- make my mule on the DS being an example of this if memory serves)
    3) Just plain text. Edit like you would other text files on a PC really. Do make sure you have the same new line, encodings and whatever else. (Some rhythm game or possibly Theta)

    I dare say there might have been a 4th where the lua was used in the game but left in as a kind of developer extra but I will have to confirm that. In that case you would likely have some kind of thing like 1) on your hands anyway -- lua tends not to compile from what I have seen and will have to come with some kind of interpreter.
     
    Monozombi likes this.
  6. Cuber456

    Cuber456 Member

    Newcomer
    28
    10
    May 19, 2012
    United States
    I thought it was funny that the devs used LUA scripts for VLR.
    Warning: Spoilers inside!

    Anyway, there was a similar project that was (or had done) a similar translation project from English to Italian for VLR. Source below:

    https://gbatemp.net/threads/wip-3ds...ist-and-discussion.380171/page-4#post-6034758

    Even though I have looked through VLR's files (models, textures and what not), I am not sure how easy it would be to edit text inside of a LUA file. It would be easy if the file size stays the same and you only overwrite text with the equivalent Spanish. It may start to get more dicey if you change the file size. I say pursue the source I gave you.

    Good Luck!
     
    Monozombi likes this.
  7. Monozombi
    OP

    Monozombi Newbie

    Newcomer
    4
    0
    Nov 16, 2015
    Argentina
    I found the lua file with the text of the beginning of the game. I used Hxd to edit it and keep the same file size, but when I put it on my 3ds and launch it, after I click "start from beginning" , the upper screen stays black and the below one shows the VN menu (with the "auto" button and stuff).
    Any idea of what caused it and how to fix it?
     
  8. Cuber456

    Cuber456 Member

    Newcomer
    28
    10
    May 19, 2012
    United States
    It depends on what you actually edited.

    There isn't exactly a fool proof way to edit a file format. Look at what you edited and compare it to the original. Look at the file structure the text is in. Some of this is just going to come down to good old fashioned trial and error and experimentation.

    That's why I recommended the source above. Somebody has already figured out the text file format. Ask them. Don't reinvent the wheel if you don't have to unless you enjoy reverse engineering. In that case, go all out.
     
  9. Monozombi
    OP

    Monozombi Newbie

    Newcomer
    4
    0
    Nov 16, 2015
    Argentina
    Okay, i'll try asking them then. Thanks for the help