Micha Posted January 6, 2015 Share Posted January 6, 2015 modmain.lua:local require = GLOBAL.require local NUIClock = require "widgets.uiclock"function NUIClock:OnGainFocus() NUIClock._base.OnGainFocus(self) local clock_str = "Fubar" self.text:SetString(clock_str) return trueendThe plan is to replace the "World 1" Text with various useful informations, best summed up by the glorious "Fubar". To me it looks like the new Object gets loaded but OnGainFocus is never called. May you guys help me out? Link to comment https://forums.kleientertainment.com/forums/topic/48516-modifying-a-single-function-of-a-widget-class/ Share on other sites More sharing options...
Mobbstar Posted January 6, 2015 Share Posted January 6, 2015 Um... I have modified a couple of classes in my mods, but beyond the AddClassPostConstruct I have no clue. Link to comment https://forums.kleientertainment.com/forums/topic/48516-modifying-a-single-function-of-a-widget-class/#findComment-597660 Share on other sites More sharing options...
Micha Posted January 6, 2015 Author Share Posted January 6, 2015 I guess I'll use it then function NewClock() local require = GLOBAL.require local NUIClock = require "widgets/uiclock" NUIClock.OnGainFocus = function (self) NUIClock._base.OnGainFocus(self) local clock_str = "Fubar" self.text:SetString(clock_str) return true endendAddSimPostInit(NewClock)Works for me Link to comment https://forums.kleientertainment.com/forums/topic/48516-modifying-a-single-function-of-a-widget-class/#findComment-597666 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now