Skip to content

Commit

Permalink
Merge pull request #3 from jsimonetti/patch-1
Browse files Browse the repository at this point in the history
Prevent non-exported struct fields to be reflected
  • Loading branch information
cschomburg committed Nov 1, 2016
2 parents b63a42e + 5f6b0ab commit 57f5e06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/luareflect/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func ToLua(L *lua.LState, data interface{}) lua.LValue {
t := L.NewTable()
for i := 0; i < typ.NumField(); i++ {
lk := lua.LString(typ.Field(i).Name)
if len(typ.Field(i).PkgPath) > 0 {
continue
}
lv := ToLua(L, val.Field(i).Interface())
t.RawSet(lk, lv)
}
Expand Down

0 comments on commit 57f5e06

Please sign in to comment.