How do I make Lua mods?

Discussion in 'Utilities and programming' started by darkpixlz, Feb 11, 2024.

  1. darkpixlz

    darkpixlz
    Expand Collapse

    Joined:
    May 6, 2023
    Messages:
    1
    Hello,

    I'm looking to make a standard radio UI mod. I know Lua, but have no idea how to use it in beam and have not found any useful documentation after checking for a couple of hours.

    How do I make one? Does it support standard Lua libraries (or others like http requests/os)? Where can I find general API docs?

    Thank you!
     
  2. daniel-w

    daniel-w
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 28, 2017
    Messages:
    282
    So... I spent a little while working on an example mod for you. I'll probably use it to introduce others as well.
    If you need any help understanding something, or have any suggestions, feel free to let me know.

    You can put the mod in mods/unpacked (create the folder if it doesn't exist). Unpack exampleMod.zip into it (make sure to not have exampleMod/exampleMod/actualContentsHere
     

    Attached Files:

    • Like Like x 1
    • Agree Agree x 1
  3. _N_S_

    _N_S_
    Expand Collapse

    Joined:
    Oct 28, 2017
    Messages:
    73
    The "load" function does not load code from a file, wrap in dump, there will be an error in the console.
     

    Attached Files:

    • 0.png
    • 1.png
    • 2.png
  4. MSLDev

    MSLDev
    Expand Collapse

    Joined:
    Mar 31, 2025
    Messages:
    4
    Your mod works, but when I tried to replicate it in a test mod of my own from scratch, modscripts would simply show an empty table. Like I redid everything step by step but in a folder and it didn't work. What sorcery did you use???
     
  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