New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua function "dfhack.gui.makeAnnouncement" does not work. #999
Comments
dfhack.gui.makeAnnouncement(df.announcement_type.CITIZEN_DEATH, {D_DISPLAY=true}, xyz2pos(1,2,3), 'test', COLOR_GREEN)
dfhack.gui.makeAnnouncement(df.announcement_type.CITIZEN_DEATH, {D_DISPLAY=true},{x=1,y=2,z=3}, 'test', COLOR_GREEN)There's also a more complicated example in |
|
I tried |
|
What other arguments did you pass? |
|
When that didn't work:
The error message indicated the position was the problem. |
|
I also added a |
|
Your I did get this, but only when I mixed up pos2xyz and xyz2pos: That's just a result of passing something to pos2xyz() incorrectly. |
|
Something like your first error, but following the stack trace took me to the line where the position is assigned. Maybe the line number was off? |
|
I'm not quite sure what you mean. I thought you were passing |
I tried that first, then I tried creating my own position table, neither one worked. The first time I got the error I followed the stack trace into native code and it took me to the line where the position was assigned, so I assumed that was what was causing the problem. I can't check to see if fixing the flags works, because I don't have DF on this computer... I can test it and get back to you on tuesday. |
|
I can't see any information in the Lua stack trace that would allow you to track down the exact line in question in the C++ code. And even if you could, the C++ function would never actually be called, because the Lua API catches invalid arguments before trying to call native code. |
|
Umm... What? The stack trace I got had line numbers and filenames for the Lua code, then more for native code (DFHack, not DF) that Lua had called into. A bit of looking found these files in the DFHack source distribution. I have no idea what stack traces you get, but the ones I get have all kinds of useful information. I ended up coding my own version of this function in pure Lua using the C++ version as a guide. |
|
This is what I got with your attempt (in the interactive interpreter): Even if you did compile DFHack with debugging information and got Lua stack traces to show line numbers of native code, you wouldn't see anything in the makeAnnouncement() function in library/modules/Gui.cpp because it was never called. |
|
Well somehow I did, I have no idea how, but I did. ... Weird, but that's what happened. Anyway, I'll have more information next tuesday. |
|
I was wr... I was wro... ahem You were right. |
|
To be fair, I had to look up that example, and I didn't even expect I might see if it's possible to give better error messages for stuff like this when I get a chance. |
Due to the way the position argument is handled this function always fails with an error. This issue also affects the other announcement functions that take a position.
The text was updated successfully, but these errors were encountered: