Hotkeys with Lua script

FakiR

New Member
Hello!
I want to write a script that will write an increasing value to a file. The script code is in the attachments.
It works, but the hotkey works twice. When a hot key is pressed once, the value 2 will be written to the file, not 1.
Where did I make a mistake?
 

Attachments

I have the same problem. The function appears to fire both on key down and key up. Any suggestions would be appreciated.

Using 26.1.1 on Windows. Nothing appears in the log.
 
I figured out how to fix it:

Lua:
function instant_replay(pressed)
 if not pressed then
  return
 end
 team1_score = team1_score + 1
 write_to_file("team1", team1_score)
end
 
Back
Top