如何在Lua中创建一个目录? [英] How to create a directory in Lua?

查看:1188
本文介绍了如何在Lua中创建一个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在lua中创建一个目录?如果是这样,那么如何?

Is it possible to create a directory in lua ? If so, how ?

推荐答案

有一个系统调用(或类似的东西,这是从内存),你应该可以用来运行一个任意的程序,其中可能包括mkdir命令。

There's a "system" call (or something like that, this is from memory) which you should be able to use to run an arbitrary program, which could include the mkdir command.

编辑:我发现我的Lua 书。在第203页,它提到如何使用

I found my Programming in Lua book. On page 203, it mentions how you could use an

os.execute("mkdir " .. dirname)

以伪造目录创建命令。

strong>编辑2:注意Jonas Thiem的警告,如果目录名来自不可信的来源,可以滥用此命令!

EDIT 2: Take note of Jonas Thiem's warning that this command can be abused if the directory name comes from an untrusted source!

这篇关于如何在Lua中创建一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆