Skip to content

Commit

Permalink
Fix numeric checking on DTextEntry and children.
Browse files Browse the repository at this point in the history
Inserting a special character like "%" will be parsed as a pattern and error. So we tell string.find not to use pattern checking.

Fixes: Facepunch/garrysmod-issues#773
  • Loading branch information
Matt Stevens committed Jan 28, 2014
1 parent c11a4cb commit 6f7fe7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions garrysmod/lua/vgui/dtextentry.lua
Expand Up @@ -323,7 +323,7 @@ function PANEL:CheckNumeric( strValue )
if ( !self:GetNumeric() ) then return false end
-- God I hope numbers look the same in every language
if ( !string.find ( strAllowedNumericCharacters, strValue ) ) then
if ( !string.find ( strAllowedNumericCharacters, strValue, 1, true ) ) then
-- Noisy Error?
return true
Expand Down Expand Up @@ -463,4 +463,4 @@ function TextEntryLoseFocus( panel, mcode )
end
hook.Add( "VGUIMousePressed", "TextEntryLoseFocus", TextEntryLoseFocus )
hook.Add( "VGUIMousePressed", "TextEntryLoseFocus", TextEntryLoseFocus )

0 comments on commit 6f7fe7c

Please sign in to comment.