From a7c8a408ce88b8818fda60eb19c0dc3f739dd86b Mon Sep 17 00:00:00 2001 From: Enyby Date: Sun, 17 Mar 2019 03:06:05 +0200 Subject: [PATCH] Fix build bug. #33 --- .../org/luaj/vm2/lib/jse/JseStringLib.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/jse/org/luaj/vm2/lib/jse/JseStringLib.java diff --git a/src/jse/org/luaj/vm2/lib/jse/JseStringLib.java b/src/jse/org/luaj/vm2/lib/jse/JseStringLib.java new file mode 100644 index 00000000..41177787 --- /dev/null +++ b/src/jse/org/luaj/vm2/lib/jse/JseStringLib.java @@ -0,0 +1,39 @@ +/******************************************************************************* +* Copyright (c) 2009 Luaj.org. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +******************************************************************************/ +package org.luaj.vm2.lib.jse; + +public class JseStringLib extends org.luaj.vm2.lib.StringLib { + + /** public constructor */ + public JseStringLib() { + } + + protected String format(String src, double x) { + String out; + try { + out = String.format(src, new Object[] {Double.valueOf(x)}); + } catch (Throwable e) { + out = super.format(src, x); + } + return out; + } +}