Jump to content

Traceback (and debug.getinfo) shows line that doesn't exist

Recommended Posts

Are there hidden files somewhere that get loaded? 

Something is calling a function and changing a structure and I'm trying to find out who/what/when/why. 

In data/scripts/componetns/hounded.lua - there is a function that is called that sets the spawnData. This is used because caves have a different set of spawn data from the forest (worms vs hounds). 


function self:SetSpawnData(data)
    _spawndata = data

I've replaced hounded with my own mod. It is a AddComponentPostInit load of the entire class and has the SetSpawnData function as well. But, for whatever reason, something somewhere is calling it with odd data. 

function self:SetSpawnData(data)   
    print("Updating _spawndata")
    print("Before: ")
    for k,v in ipairs(_spawndata.warning_sound_thresholdsdo
    _spawndata = data
    print("After: ")
    for k,v in ipairs(data.warning_sound_thresholdsdo

Whoever is calling this is changing the valid "houndwarning_lvl1" to :"LVL1". Same for "LVL2", "LVL3", "LVL4". Likewise, the caves changes it from "wormwarning_lvl1", to "LVL1_WORM", "LVL2_WORM", ... etc. 

I can't find those strings anywhere. Those sound prefabs don't exist. It should be "houndwarning_lvl1" in the forest, not "LVL1". 

OK, I'll just print out who is calling this, right? 

function self:SetSpawnData(data)
    local level = 1
    while true do
      local info = debug.getinfo(level, "Sl")
      if not info then break end
      if info.what == "C" then   -- is a C function?
        print(level, "C function")
      else   -- a Lua function
                            info.source, info.currentline))
      level = level + 1


Which generates the following:

[00:26:49]: [../mods/DST-Hounded/scripts/components/hounded.lua]:1011    
[00:26:49]: [scripts/prefabs/forest.lua]:473    
[00:26:49]: [scripts/prefabs/world.lua]:431    

.....but, there is no line 473 in forest.lua. That file is only 250ish lines. It's the same line if I throw an exception and look at the traceback.too.

I search the entire game folder, there is no reference to anything that might call SetSpawnData., It does exist in forest.lua, but the data structure I see in there looks right. And modifying that function in the game code doesn't print out anywhere. In fact, I can put in syntax errors and it changes nothing. I'm convinced /scripts/prefabs/forest.lua isn't used at all.


It's been years since I wrote this mod and have posts on the workshop saying it's broken, so I want to update it to get it working with the latest....but I'm lost. Everything is now working, except for the hound warning isn't playing.


Thank you!

Link to comment
Share on other sites

[00:01:09]: @scripts/prefabs/forest.lua:473 in master_postinit    


Wait, you know what? 

What is /data/databundles??!??


There is a scripts.zip in there, and sure enough, it has all the info I'm looking for!


    --Key = time, Value = sound prefab
    warning_sound_thresholds =
        { time = 30, sound =  "LVL4" },
        { time = 60, sound =  "LVL3" },
        { time = 90, sound =  "LVL2" },
        { time = 500, sound = "LVL1" },


In fact, the hounded component is different too. 


Why are these files different than the ones installed?!? 


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...