Jump to content

Modifying a single function of a widget class


Micha

Recommended Posts

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 trueend

The 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
Share on other sites

I guess I'll use it then :D

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
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...