Skip to content

Dump generation #1

Open
Open

Description

@MNoya
  • cl_panorama_script_help_2 (Crashes the game currently)
  • script_help2
  • cl_script_help2
  • dump_panorama_css_properties
  • dump_panorama_events
function DumpObjectIndented(obj, indent)
{
  var result = "";
  if (indent == null) indent = "";

  for (var property in obj)
  {
    var value = obj[property];
    if (typeof value == 'string')
      value = "'" + value + "'";
    else if (typeof value == 'object')
    {
      if (value instanceof Array)
      {
        // Just let JS convert the Array to a string!
        value = "[ " + value + " ]";
      }
      else
      {
        // Recursive dump
        // (replace "  " by "\t" or something else if you prefer)
        var od = DumpObjectIndented(value, indent + "  ");
        // If you like { on the same line as the key
        //value = "{\n" + od + "\n" + indent + "}";
        // If you prefer { and } to be aligned
        value = "\n" + indent + "{\n" + od + "\n" + indent + "}";
      }
    }
    result += indent + "'" + property + "' : " + value + ",\n";
  }
  return result.replace(/,\n$/, "");
}

Activity

  1. SinZ163 commented on Aug 29, 2016

    @SinZ163
    Member

    Pushed enumdump.ts and DefinitionGenerator.py from ModDota/DotaUI to this repo.

    • enumdump.ts generates dota_enum.d.ts and for all intents and purposes is a refined version of OP's function, but it will only spit out constants, and also adds the file header at the top.
    • DefinitionGenerator.py accepts input from cl_panorama_script_help $TYPE and spits out vaguely typescript declaration that a human needs to go through later and clean up (Valves documentation is very vague on a lot of types)

    Calling all @ModDota/panorama to inspect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions