I wanted to use Lua Lanes for multithreading and time recording. Here is the code:
require "lanes"
function performTest ()
os.execute("testJson-mt.lua")
end
for i=1,10,1 do
f= lanes.gen(performTest)
a=f()
startTime = os.time()
print("ID "..a[1].." completed.")
endTime = os.time()
diff = os.difftime (endTime, startTime)
print(i..","..os.date("%x %X",startTime)..","..os.date("%x %X",endTime)..","..startTime..","..endTime..","..diff)
end
However, when I run the code, the console returns an error: lua: testLanes.lua:4: attempt to index global 'os' (a nil value).
This error code points to this line where os.execute("testJson-mt.lua"). I do not quite understand this error. Please inform.
Note. I use Lua for Windows as a development environment.
source
share