0

我有个问题。为什么我无法从 Tarantool LUA 管理控制台访问文件?我在监狱里吗?

tarantool -h myhost -a 33015
help

console client commands:
- help
- loadfile 'path'
- setopt key=val
- (possible pairs: delimiter = 'string' )
- ( pager = 'command' )
...
---
available commands:
- help
- exit
- show info
- show fiber
- show configuration
- show slab
- show palloc
- show stat
- show plugins
- save coredump
- save snapshot
- lua command
- reload configuration
- show injections (debug mode only)
- set injection <name> <state> (debug mode only)
...


myhost> lua file = io.open("/etc/motd", "r")

attempt to index global ''io''

我也不能使用套接字模块:

[string "local s=require(''socket'');local t=assert(s.tc..."]:1: attempt to call global ''require''

是否可以从 Tarantool LUA 控制台中读取文件并执行命令?

4

1 回答 1

0

Lua 是一种可扩展、可嵌入的语言。使用该语言的宿主程序不需要打开标准库。因此,并非所有使用 Lua 的程序都会打开ioorpackage库。相反,他们可能会选择实施并随后打开他们自己的库。

您正在寻找的 Tarantool 模块是fio,并且名称类似fio.open

file_handle = fio.open('/etc/motd', { 'O_RDONLY' })

请注意,Tarantool 也有一个内置socket模块。


资料来源:

于 2016-10-30T08:54:56.930 回答