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

Problem to Add nested LTable in LTable #49

Closed
skyhit opened this issue Sep 7, 2015 · 3 comments
Closed

Problem to Add nested LTable in LTable #49

skyhit opened this issue Sep 7, 2015 · 3 comments
Labels

Comments

@skyhit
Copy link

skyhit commented Sep 7, 2015

When using RawSet function to add a LTable inside another LTable, I got error like

cannot use *llTable (type lua.LTable) as type lua.LValue in argument to ltable.RawSet: lua.LTable does not implement lua.LValue (String method has pointer receiver)

but I see lua.LTable do implement lua.LValue interface. any idea?

@yuin
Copy link
Owner

yuin commented Sep 7, 2015

Can I see your code?
Please note that lua.LTable is not *lua.LTable.

@skyhit
Copy link
Author

skyhit commented Sep 7, 2015

try the following code.

package main

import "github.com/yuin/gopher-lua"

func main() {
    L := lua.NewState()
    defer L.Close()
    input := &lua.LTable{}
    input.RawSet(lua.LString("test"), lua.LTable{})
}

@skyhit
Copy link
Author

skyhit commented Sep 7, 2015

ok, other than lua.LNumber, lua.LString, we need to pass the pointer, instead of the object.

&lua.LTable{} seems working.

@yuin yuin closed this as completed Sep 7, 2015
@yuin yuin added question and removed help wanted labels Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants