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

Push arbitrary Go types on Lua stack #5

Open
aybabtme opened this issue Mar 24, 2014 · 0 comments
Open

Push arbitrary Go types on Lua stack #5

aybabtme opened this issue Mar 24, 2014 · 0 comments

Comments

@aybabtme
Copy link
Contributor

Should be able to push arbitrary types on Lua, such as structs with fields and methods. For instances:

func (l *lua.State) int {
    u, err := url.Parse(...)
    if err != nil { ... }
    return lua.DeepPush(l, u)
}

Would expose all the fields and methods of var u url.URL. Changing the fields from lua would change the fields in the actual u on the Go side, so that u.String() would reflect the changes made in lua:

u = url.parse("http://bing.com/search?q=dotnet")
u.scheme = "https"
u.host = "google.com"
q = url.query()
q.set("q", "golang")
url.rawQuery = q.encode()
equals("can change string", "https://google.com/search?q=golang", u.string())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant