Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.write discards spaces after trailing numbers #92

Open
spakin opened this issue Jan 19, 2018 · 0 comments
Open

io.write discards spaces after trailing numbers #92

spakin opened this issue Jan 19, 2018 · 0 comments

Comments

@spakin
Copy link

spakin commented Jan 19, 2018

Consider this Lua code:

io.write("123 ")
io.write("456 ")
io.write("Hello, ")
io.write("world!\n")

This does what it's supposed to when run with the standard Lua interpreter:

$ lua5.3
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> dofile("bad-format.lua")
123 456 Hello, world!
> 

Now run the code using go-lua:

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)
	}
}

The space following each number mysteriously disappears:

$ go run bad-format.go bad-format.lua
123456Hello, world!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant