用lua的io.open打开文件,文件路径怎么写

用lua的io.open打开文件,文件路径怎么写,第1张

访问路径和普通访问一样

比如在windows下

你要是调用

local

file

=

ioopen("1txt")

那这样会访问同目录下的

1txt

你也可以用绝对路径

local

file

=

ioopen("c:/1txt")

fn_flag = stringfind(filename, "\\")if fn_flag thendest_filename = stringmatch(filename, "+\\([^\\]%%w+)$")endfn_flag = stringfind(filename, "/")if fn_flag thendest_filename = stringmatch(filename, "+/([^/]%%w+)$")end更多详见 >

FreeSWITCH中的lua *** 作小结

lua中设置当前通道变量

方法一:

session:setVariable("fullName", "xxxxx");--需判断session是否为空

方法二:

local uuid =getUUID(callerid);

local res=api:executeString("uuid_setvar " uuid " fullName ""xxxxxxx")

该处设置的变量可以是通道中本没有的变量,设置完了后,在其他地方就可以引用该变量。

lua中设置全局通道变量(在varsxml中设置)

local ucall_ip = api:executeString("global_setvar qt_ucall_ip_port 192168032:9090");

获取当前的通道变量

local callee_num=session:getVariable("qt_ucall_callee");

获取全局通道变量

local ucall_ip = api:executeString("global_getvar qt_ucall_ip_port");

获取当前会话uuid

session:get_uuid()

获取当前路径

--USwitch的当前安装目录

syspath = tostring(api:execute("global_getvar", "base_dir"));

使用uuid_transfer将当前对话的两个号码同时转入会议中

local trf1="uuid_transfer " guestuuid " -both " conferenceNum;

OutputConsoleLog("info" , scriptname ": try to get guestNum to conference,command is{"trf1"}");

api:executeString(trf1);

外呼方法总结:

originate user/11103139316095XX

originate sofia/external/139316095XX@192168234 &playback(calloutmusic/welcometoyoump3)

originate loopback/139316095XX&playback(calloutmusic/20110126164156mp3)

在lua脚本中放一段录音

session:streamFile("notondutywav");

判断会话是否已建立

session:ready()==true

挂断当前会话

session:hangup();

将当前会话休眠一段时间

session:sleep(5000);

发起>

以上就是关于用lua的io.open打开文件,文件路径怎么写全部的内容,包括:用lua的io.open打开文件,文件路径怎么写、lua如何从全路径中获取文件名(linux、windows通用)、FreeSWITCH中的lua *** 作小结等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9689232.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-01
下一篇2023-05-01

发表评论

登录后才能评论

评论列表(0条)

    保存