lua lfs on flashair w04 seems not to work

时间:2018-06-18 11:37:08

标签: lua flashair

Hi for the last week i have been trying to get my Flashair to upload its files over ftp.

I can make a ftp connection without any problems, but when i try to iterate over the files in its folder its gives me a error on the lua lfs, the only thing its returning is nil.

its goes about this code sample:

for file in lfs.dir(localDir) do
attr = lfs.attributes(localDir .. file)
print( "Found "..attr.mode..": " .. file )
  if attr.mode == "file" then
    response = fa.ftp("put", ftpString..file, localDir .. file)
    if response ~= nil then
        print("Success!")
    else
        print("Fail!")
    end
  end
end

the error i get is:

lua: ftp.lua:17: attempt to index a nil value (global 'lfs') stack traceback: ftp.lua:17: in main chunk [C]: in ?

where line 17 is the first line in the provided code sample.

Am I missing something, seems that i cannot find a lot information about this problem in combination with the Flashair.

Any help would be appreciated.

1 个答案:

答案 0 :(得分:1)

我是Lua的新手,所以如果我的回应对您没有帮助,请不要解雇我。我一直在为W-03开发一个应用程序,在我的MACBOOK linux虚拟环境中测试Lua应用程序时,我看到了相同的错误,并发现我必须在测试代码中使用require“ lfs”语句。在实际的W-03上运行时,不需要“ lfs”。