Lua 向 VB Net 传递变量

如何从 Lua 中获取变量(视频文件名)并在 VB Net 中使用?

在 Lua 中:

function videoID(sender, vidsource)
 if sender.Name == 'Awaken' then
    vidsource = 'awaken.mp4'
 elseif sender.Name == 'Crew' then
    vidsource = 'Crew.mp4'
 else
    return vidsource
 end
 local f = assert(io.open(main_path..'/GLauncherResources/video.txt', "w"))
 f:write(vidsource)
 f:close()
end

接下来,在 VB Net 中,我想要从文件 video.txt 中读取一个变量(只包含 1 行),并将变量用作在 vb net 中播放的视频名称:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim video As String
        Dim path As String = "E:\GLauncherResources\video.txt"
        video = File.ReadAllLines(path).ToString()
        Console.Write(video)
        MediaPlayer1.URL = video

        'Dim video = IO.File.ReadAllLines(My.Application.Info.DirectoryPath & "\video.txt")
        'MediaPlayer1.URL = video
    End Sub

或者有其他方法可以传递变量而不需要保存到文本文件中吗?

点赞