OSDN Git Service

socket.gettime -> os.socketgettime if available
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 29 Apr 2023 21:34:33 +0000 (06:34 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 29 Apr 2023 21:34:33 +0000 (06:34 +0900)
src/ltj-debug.lua
src/ltj-inputbuf.lua
test/test61-unhcopy.tex

index 9122426..97105e6 100644 (file)
@@ -86,10 +86,9 @@ end
 ltjdbg.pformat = pformat
 
 -------------------- 所要時間合計
-require("socket")
 do
    local max = math.max
-   local gettime = socket.gettime
+   local gettime = os.socketgettime or (socket and socket.gettime)
    local time_stat = {}
    local function start_time_measure(n)
       if not time_stat[n] then
index 66a466e..70195d4 100644 (file)
@@ -57,7 +57,6 @@ end
 end
 --- the following function is modified from jafontspec.lua (by K. Maeda).
 --- Instead of "%", we use U+FFFFF for suppressing spaces.
---DEBUG require"socket"
 local time_line = 0
 local start_time_measure, stop_time_measure
    = ltjb.start_time_measure, ltjb.stop_time_measure
index e002c70..bfde94f 100644 (file)
@@ -11,7 +11,9 @@
 %%% \expandafter...\relax
 
 \directlua{
-  socket=require'socket'
+  if not socket then
+    socket = socket or {}; socket.gettime = os.socketgettime
+  end
   my_a=socket.gettime()
 }