pos是否可以在 lua 4.0 中包含 os 库?
Is it possible to include the os library in lua 4.0?
我一直在使用 lua 的 4.0 版本,它似乎不支持 os 库。有没有办法将这个库包含到我的项目中?
或者获取另一种方法来使用与日期时间计算相关的功能?
最好使用 *.lua 文件而不是 *.c 文件,因为我无法完全访问代码。
当我运行下面一行时,
print(os.time{year=1970, month=1, day=1, hour=0})
我收到一条错误消息:
attempt to index global 'os'(a nil value)
正如 @Colonel Thirty Two 所说,os 无法使用 os 库。所以我不能使用 time() 函数。
添加到(完全正确的) (that if "os" access was not allowed to you, you're generally done), there's some very slight chance the Original Programmer may have provided you with some alternative facilities to do your thing (fingers crossed). In a perfect world, those would be described in some kind of a User's Manual for your scripting environment. But if the manual was lost to time (or never existed in the first place), you might possibly try your luck at exploring any preloaded libraries by digging through the result of the globals()
基本功能。 (至少我希望在 4.0 中也是这样做的。)也就是说,如果原始程序员也没有为您阻止 globals()...
我一直在使用 lua 的 4.0 版本,它似乎不支持 os 库。有没有办法将这个库包含到我的项目中? 或者获取另一种方法来使用与日期时间计算相关的功能?
最好使用 *.lua 文件而不是 *.c 文件,因为我无法完全访问代码。
当我运行下面一行时,
print(os.time{year=1970, month=1, day=1, hour=0})
我收到一条错误消息:
attempt to index global 'os'(a nil value)
正如 @Colonel Thirty Two 所说,os 无法使用 os 库。所以我不能使用 time() 函数。
添加到(完全正确的)globals()
基本功能。 (至少我希望在 4.0 中也是这样做的。)也就是说,如果原始程序员也没有为您阻止 globals()...