Change os.clock multiplier, update Dockerfile to use lua 5.3.5.5
authorGabriel M <gmadruga@tdtconsultants.com>
Sun, 17 May 2020 17:23:54 +0000 (14:23 -0300)
committerGabriel M <gmadruga@tdtconsultants.com>
Sun, 17 May 2020 17:23:54 +0000 (14:23 -0300)
impls/lua/Dockerfile
impls/lua/core.lua

index e93a1d0..1fc29ea 100644 (file)
@@ -22,9 +22,22 @@ WORKDIR /mal
 ##########################################################
 
 # Lua
-RUN apt-get -y install lua5.2 liblua5.2-dev lua-rex-pcre luarocks
-RUN luarocks install linenoise
-RUN luarocks install luasocket
+RUN apt-get -y install gcc wget unzip libpcre3-dev
+
+RUN \
+curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz && \
+tar -zxf lua-5.3.5.tar.gz && \
+cd lua-5.3.5 && \
+make linux test && \
+make install
+
+RUN \
+wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz && \
+tar zxpf luarocks-3.3.1.tar.gz && \
+cd luarocks-3.3.1 && \
+./configure && \
+make && \
+make install
 
 # luarocks .cache directory is relative to HOME
 ENV HOME /mal
index 2da9c50..1d8a07f 100644 (file)
@@ -3,7 +3,6 @@ local types = require('types')
 local reader = require('reader')
 local printer = require('printer')
 local readline = require('readline')
--- local socket = require('socket')
 
 local Nil, List, HashMap, _pr_str = types.Nil, types.List, types.HashMap, printer._pr_str
 
@@ -278,7 +277,7 @@ M.ns = {
     ['-'] =  function(a,b) return a-b end,
     ['*'] =  function(a,b) return a*b end,
     ['/'] =  function(a,b) return math.floor(a/b) end,
-    ['time-ms'] = function() return math.floor(os.clock()*1000) end,
+    ['time-ms'] = function() return math.floor(os.clock()*1000000) end,
 
     list = function(...) return List:new(table.pack(...)) end,
     ['list?'] = function(a) return types._list_Q(a) end,