View Single Post
06/20/19, 02:09 PM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by jc28735250 View Post
Hi all!

I'm attempting to fix a bug in an existing addon that deals with gamepad UI (specifically, trying to disable it), and it does this by overriding the global function IsInGamepadPreferredMode(). But now I've realized that in order to fix the bug I need to know whether we started the game session in gamepad mode or keyboard mode. Now, usually this is done by calling IsInGamepadPreferredMode(), but I can't do that since I'm overriding the function with my own behavior. There's also the EVENT_GAMEPAD_PREFERRED_MODE_CHANGED event that I can subscribe to, but that doesn't fire on login.

I'm wondering if it's possible somehow to call the base, non-overridden function to know whether the gamepad is enabled or not at the beginning? If that isn't possible, are there other possible places I can look into? Thanks in advance!
You have to backup the function before you redefine it.
Lua Code:
  1. local orgIsInGamepadPreferredMode = IsInGamepadPreferredMode
  Reply With Quote