Post subject: Help with input.registerhotkey() attempt to index a functio
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
		MenuDis=0;
	else
		MenuDis=1;
		sound.clear();
	end
end
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, Expert player (2073)
Joined: 6/15/2005
Posts: 3282
Could you post your whole script? (You can use pastebin.com if you need).