can not use State.Next() func read lua array
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- Meio dia
- Facilidade para iniciantes
- 40/100
Direção de pesquisa
The bug is in the table code: arrayIndex in tables.go assumes numeric keys are float64, but the reporter sees string keys reaching it from State.Next(). Start by reproducing with a Lua array read through the Go loop from the issue, then trace how Next walks the array part. Done means iterating a Lua array with Next returns numeric keys without panicking, with a regression test added.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
// balabala....
if l.IsTable(-1) {
var m = map[string]string{}
l.PushNil()
for l.Next(-2) {
key, _ := l.ToString(-2)
value, _ := l.ToString(-1)
l.Pop(1)
m[key] = value
}
l.Pop(2)
return m
}
// balabala....
table is ok, but array will panic.
add some debug log tables.go:215
func arrayIndex(k value) int {
if n, ok := k.(float64); ok {
fmt.Println("array_index", k, n)
} else {
t := reflect.TypeOf(k)
fmt.Println("array_index", t, k)
}
if n, ok := k.(float64); ok {
if i := int(n); float64(i) == n {
return i
}
}
return -1
}
it is a string type.
array_index <nil> <nil>
array_index string 1
array_index string 1
- Linguagem predominante
- Go
- Estrelas
- 3.5k
- Forks
- 217
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Shopify/go-lua
-
Numeric modulo fast path disagrees with Lua 5.2 and the library fallback for negative operandsTalvez já em andamento @efegokdemir assumiu há 35 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
io.write discards spaces after trailing numbersTalvez já em andamento @flynn-eye assumiu há 25 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
State.close leaves closed upvalues in the open list, so calls get slower without boundTalvez já em andamento @efegokdemir assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
Todas as issues de Shopify/go-lua
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
limitlessprojects/Go-Hybrid#4764 ·
Mantenedores costumam responder em até 1 dia
-
[bug]: lint fails on main, generated CLI docs out of dateTalvez já em andamento @bupd assumiu hoje. Abertabug documentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
goharbor/harbor-cli#1180 ·
Mantenedores costumam responder em até 1 dia
-
crane: mutate --env adds duplicate PATH on Windows images when key case differsTalvez já em andamento @aad1tyaaaaa assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
google/go-containerregistry#2523 ·
Mantenedores costumam responder em até 4 dias
-
bosh_io_stemcell_type: regular does not work for noble and resolute as it adds -go_agent as suffixAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
cloudfoundry/bosh-deployment-resource#138 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100