Merge "Make lang:parseFormattedNumber more like tonumber"

This commit is contained in:
jenkins-bot 2013-07-08 21:15:25 +00:00 committed by Gerrit Code Review
commit 0f45f9e5cb

View file

@ -113,7 +113,10 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
if ( is_numeric( $args[0] ) ) {
$args[0] = strval( $args[0] );
}
$this->checkType( $name, 1, $args[0], 'string' );
if ( $this->getLuaType( $args[0] ) !== 'string' ) {
// Be like tonumber(), return nil instead of erroring out
return array( null );
}
return array( $lang->$name( $args[0] ) );
// Custom handling