Lua OS error attempt to index a nil value (global 'os') and read file

local time = tostring(os.time())

Lua: ./scripts/testScript.lua:113: attempt to index a nil value (global ‘os’)

What should I do?

Can I read the file located in the same folder with the script, if so, how?

We don’t have the os bindings as were not running on a compatible operating system. There are a number of other time related bindings you can use. millis() and micros() for example. File access works as normal.

I’m sorry, I didn’t understand exactly how I can read the file, I’ll be glad to see the code example.

I’m sorry, I didn’t understand exactly how I can read the file, I’ll be glad to see the code example. )

This example reads from a file:

The code throws this error
Could not open mission1.txt

As I understand it, the error occurs due to the fact that I move the file "mission1.txt " to the folder in the script, while this file should be stored on the SD card