Modding Help How do I just make a simple log with Lua?

Discussion in 'Starbound Modding' started by Avalin, Jan 4, 2025.

  1. Avalin

    Avalin Big Damn Hero

    I just want to create log my mod is initialized. I managed to do it in player.config.patch with the following:

    Code:
    [
      {
        "op": "add",
        "path": "/genericScriptContexts/modInitializer",
        "value": "/scripts/mod_initializer.lua"
      }
    ]
    
    But it doesnt seem clean to do it on the player... How would I go about doing this from the world (or somewhere that makes better sense?) I have a hard time locating it in the unpacked assets :)

    Even sadder, I had to insert it into an update for it to print to the in-game log. (otherwise chat isn't ready)
    So you can probably tell how annoying that is. :D
     
    Last edited: Jan 4, 2025
  2. Rezetrx

    Rezetrx Void-Bound Voyager

    I think the player makes the most sense. As far as I know, there isn't a global start hook that you can tab into. As such, the player script is the easiest to access. Scripts that run on the player are also always loaded and running, while playing.
    As for the "update" function, you can also add and use an "init" function for one-time info and such.

    Code:
    
    function init()
        sb.logInfo("-- Loaded Player Script --")
    end
    
    
     

Share This Page