Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2018 21:39:47 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329756 - in head/stand: liblua lua
Message-ID:  <201802212139.w1LLdlLF021931@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Wed Feb 21 21:39:47 2018
New Revision: 329756
URL: https://svnweb.freebsd.org/changeset/base/329756

Log:
  lualoader: Remove nasty hack for not printing out ".0"
  
  luaconf.h has a LUA_COMPAT_FLOATSTRING option that may be defined to do this
  instead of needing intstring.
  
  Reported by:	Dan Nelson

Modified:
  head/stand/liblua/luaconf.h
  head/stand/lua/screen.lua

Modified: head/stand/liblua/luaconf.h
==============================================================================
--- head/stand/liblua/luaconf.h	Wed Feb 21 21:18:04 2018	(r329755)
+++ head/stand/liblua/luaconf.h	Wed Feb 21 21:39:47 2018	(r329756)
@@ -405,6 +405,7 @@
 ** because this is not really an incompatibility.
 */
 /* #define LUA_COMPAT_FLOATSTRING */
+#define	LUA_COMPAT_FLOATSTRING
 
 /* }================================================================== */
 

Modified: head/stand/lua/screen.lua
==============================================================================
--- head/stand/lua/screen.lua	Wed Feb 21 21:18:04 2018	(r329755)
+++ head/stand/lua/screen.lua	Wed Feb 21 21:39:47 2018	(r329756)
@@ -31,17 +31,6 @@ local core = require("core")
 
 local screen = {}
 
--- XXX TODO: This should be fixed in the interpreter to not print decimals
-local intstring = function(num)
-	local str = tostring(num)
-	local decimal = str:find("%.")
-
-	if decimal then
-		return str:sub(1, decimal - 1)
-	end
-	return str
-end
-
 -- Module exports
 function screen.clear()
 	if core.isSerialBoot() then
@@ -55,7 +44,7 @@ function screen.setcursor(x, y)
 		return
 	end
 
-	loader.printc("\027[" .. intstring(y) .. ";" .. intstring(x) .. "H")
+	loader.printc("\027[" .. y .. ";" .. x .. "H")
 end
 
 function screen.setforeground(c)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802212139.w1LLdlLF021931>