Tutorial on finding Lua functions

Discussion in 'Programming' started by angelo234, Aug 5, 2021.

  1. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Without any proper Lua documentation as of now, it seems like an impossible task to figure out what functions exist. Fortunately, there is a way to figure out what functions exist (at least ones that are used).

    1. Download Agent Ransack (or another file searching program but this tutorial will be based on Agent Ransack).
    2. Set the folder to search in the subdirectory "BeamNG.drive\lua" located in the Steam library folder.
    • e.g. "C:\Program Files (x86)\Steam\steamapps\common\BeamNG.drive\lua" for default Steam library folder location
    • Since Game Engine and Vehicle Lua don't share the same Lua functions, you need to filter functions specific to the Lua environment you are coding in.
      • For Game Engine Lua functions, search in the subdirectory "BeamNG.drive\lua\ge"
      • For Vehicle Lua functions, search in the subdirectory "BeamNG.drive\lua\vehicle"
    3. Set the file name as: "*.lua" (without quotes) which tells it to only search Lua files.
    4. Come up with keyword(s) related to the function you are trying to look for and in the "Containing text" field, type in the keyword(s).

    Example:
    2.png

    5. Cross your fingers and press "Start" ;)
    6. In the "Hits" tab, you will find text matches to the keywords you typed and will be highlighted.

    3.png

    7. If a file's results look interesting, just double click on the file to open it in a text editor.
    Hopefully, this will help those new to creating Lua mods :)
     
    • Like Like x 6
  2. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Tried the same thing with Notepad++ a while ago but it crashes the whole program because there are too many. Maybe you should make a list of all GE and Vehicle functions with brief descriptions of what they do if you can figure it out? That would be really useful!
     
  3. S.Ali.M

    S.Ali.M
    Expand Collapse

    Joined:
    Jan 12, 2021
    Messages:
    1,079
    I always use winrar. It exactly does the same
     
  4. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    There are a lot of functions to document lol. Yeah I guess I could try to create a tree diagram/structure of the GE and Vehicle Lua modules' functions with a function searching feature and host it on a GitHub page.
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice