Jump to content

Recommended Posts

Posted

I'm trying to use mist.dynAdd() and I keep receiving this error: [string "C:\Users\Nick\AppData\Local\Temp\DCS\/~mis000063E1"]:613: bad argument #1 to 'pairs' (table expected, got nil)

 

How can I gain better insight into what is causing the error?, as far as I can tell the error report doesn't give me hardly any useful to help narrow it down. These vague error reports are constantly an issue for me, am I missing something?

Posted

I figured it out. Documentation led me to believe that it should be vars.unitsTable when it should actually be vars.units. Information about how to track down bugs is still appreciated though.

Posted

If you have not already, take a look at DCS Witchcraft (link in my sig). It provides an interactive Lua console that allows you to execute Lua snippets in a running mission and get the results.

 

See this thread for an example of how to use it to interactively try out new functions.

 

To debug your error, I would probably have looked at line 613 in mist.lua, noticed it was looking for "newGroup.units" instead of "newGroup.unitsTable" and then used the Lua Console to quickly confirm that this solves the issue.

Posted

Thanks. I actually have been using witchcraft and it's great. But since the error is occurring in an underlying script and not in the actual code the problem area doesn't get highlighted. I hadn't realised that the number was a line number that is very useful.

  • Recently Browsing   0 members

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