Jump to content

Recommended Posts

i want to close the check for valid characters, 

here is the orginal code:

function TextEdit:OnTextInput(text)	if not self.editing then return end	if not self.shown then return end	if self.limit then		local str = self:GetString()		--print("len", string.len(str), "limit", self.limit)		if string.len(str) >= self.limit then			return		end	end	if self.validchars then		if not string.find(self.validchars, text, 1, true) then			return		end	end		self.inst.TextEditWidget:OnTextInput(text)end

and i use AddClassPostConstruct to do it,but i turns out wrong

AddClassPostConstruct("widgets/textedit", function(self,...)	if not self.OnTextInput then return end	--self.OnTextInput(...)	self.OldOnTextInput=self.OnTextInput	local function NewOnTextInput(self,text)		self.OldOnTextInput(text)			if not self.editing then return end		if not self.shown then return end		if self.limit then			local str = self:GetString()			--print("len", string.len(str), "limit", self.limit)			if string.len(str) >= self.limit then				return			end		end		--to comment		-- if self.validchars then			-- if not string.find(self.validchars, text, 1, true) then				-- return			-- end		-- end			self.inst.TextEditWidget:OnTextInput(text)		end	self.OnTextInput=NewOnTextInputend)

so ,so coule anyone help me 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...