Jump to content

The 'net' singleton has removed the 'log' function. It is now its own singleton. HoggitWorld documentation is out of date.


Go to solution Solved by TEMPEST.114,

Recommended Posts

Posted (edited)

So I know the documentation, such that it is and unofficial etc, but here: https://wiki.hoggitworld.com/view/DCS_singleton_net

It says that there are many functions, including 'log', in that singleton.

However, when looking into it via Visual Studio Code (https://github.com/asherao/DCS-Scripting-Library), log and many of the others, is no longer inside 'net'.

e.g.

Screenshot 2024-04-30 014133.png

I understand these are a third party creation so they can't be relied to be The Truth.

So, I did an investigation. I made a logging script with a logging function:

function LogWrite(moduleString, level, message, ...)
  
  -- THIS FAILS
  net.log.write(moduleString, net.log[level:upper()], string.format(message, ...))
  
  -- THIS WORKS
  log.write(moduleString, log[level:upper()], string.format(message, ...))

end

If log is supposed to exist inside the 'net' singleton, then the first line should work, however it only works as it's own 'singleton' or a global function.

Can we get some clarification on this please?

@Grimes Do you have any thoughts or knowledge about why log breaks with net.log?  
 

 

 

Edited by Elphaba
  • Solution
Posted

It seems at some point 'log' became it's own singleton; if you scrape all the .lua files in DCS World then they all do things like this:

  D:\DCS World\MissionEditor\modules\MeSettings.lua
    Line   4: local log              = require('log')

So I'm guessing this happened at some point after the unofficial documentation was made and it's out of date. 

I think I answered my own question. LOL

  • TEMPEST.114 changed the title to The 'net' singleton has removed the 'log' function. It is now its own singleton. HoggitWorld documentation is out of date.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...