The IO library seems to be implemented, but I can't get it to work correctly. This is my Go code:
package main
import "github.com/Shopify/go-lua"
import "os"
func main() {
l := lua.NewState()
lua.OpenLibraries(l)
if err := lua.DoFile(l, os.Args[1]); err != nil {
panic(err)
}
}
And this is the contents of my Lua file:
for line in io.lines("lines.txt") do
print(line)
end
When run with C-Lua it correctly reads in the file and prints it back out, however, with go-lua it just outputs nothing. Upon closer inspection I discovered that io.lines always returns nil, indicating EOF. Am I doing something wrong or is the io library just not ready (yet)?
The IO library seems to be implemented, but I can't get it to work correctly. This is my Go code:
And this is the contents of my Lua file:
When run with C-Lua it correctly reads in the file and prints it back out, however, with
go-lua
it just outputs nothing. Upon closer inspection I discovered thatio.lines
always returnsnil
, indicating EOF. Am I doing something wrong or is theio
library just not ready (yet)?