Permalink
Browse files

Fix numeric checking on DTextEntry and children.

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...
1 parent c11a4cb commit 6f7fe7cebe3f99964e099b2fb9a56024fd3fdfee @HandsomeMatt HandsomeMatt committed Jan 28, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 garrysmod/lua/vgui/dtextentry.lua
@@ -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
@@ -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.