Lus script error - attempt to index a nil value (global 'os')

2.4k views Asked by At

I am trying to fetch the UTC time as per below code in my Lua script.

local tim = os.time()                                   
local currentUTC = os.date('!%Y-%m-%d-%H:%M:%S', tim)
payload["UTC"] = currentUTC

I am getting below error at the 1st line.

attempt to index a nil value (global 'os')

Please help me in fetching the UTC time without this error.

0

There are 0 answers