svn commit: r329756 - in head/stand: liblua lua

Kyle Evans kevans at FreeBSD.org
Wed Feb 21 21:39:48 UTC 2018


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)


More information about the svn-src-head mailing list