// A new LuaObject from stack index. func NewLuaObject(L *lua.State, idx int) *LuaObject { tp := L.LTypename(idx) L.PushValue(idx) ref := L.Ref(lua.LUA_REGISTRYINDEX) return &LuaObject{L, ref, tp} }