Post subject: Help with input.registerhotkey() attempt to index a functio
Experienced Forum User
Joined: 2/5/2014
Posts: 28
So I've got a standard "while true do" loop setup for this lua script I'm building. Prior to entering the main loop I call a "input.registerhotkey(1,TglMenu)" The TglMenu function is before the register call as per lua specifications. There is absolutely nothing in the TglMenu function.... actually here it is:
function TglMenu()
	if MenuDis>=1 then
As you can see all it is doing is toggling the value of the variable "MenuDis" which in my main loop is used to determine if a menu should be drawn on screen. If you toggle off and on the menu a few times, it doesn't matter how slow... seemingly at random the error "attempt to index a function" will throw and the script exits. Any ideas what could be causing this?
Editor, Experienced Forum User, Skilled player (1846)
Joined: 6/15/2005
Posts: 3192
Could you post your whole script? (You can use if you need).