Lua Lanes: attempt to index global 'os' (a nil value)
lua
Solution
By default, `lanes.gen` loads no libraries, not even base libraries. Therefore pass `'*'` as the first parameter to `lanes.gen` to get the `os` and other modules in the lane.
Problem
I wanted to use Lua Lanes to do a multithreading and record the time taken. 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 point to this line where `os.execute("testJson-mt.lua")`. I don't quite understand this error. Please advise. Note: I am using Lua for Windows as the IDE.