Skip to content

Panic on attempt to index a string value #524

@ligurio

Description

@ligurio

Please answer the following before submitting your issue:

  • What version of GopherLua are you using? : ccacf66
  • What version of Go are you using? : 1.23.6
  • What operating system and processor architecture are you using? : Ubuntu 24.04 amd64
  • What did you do? : See below
  • What did you expect to see? : See below
  • What did you see instead? : See below

The Lua source code below

debug.setmetatable('string', {})
do ('Lua').key = 1 end;

triggers a panic in GopherLua:

$ /home/sergeyb/sources/go/bin/glua -e "
debug.setmetatable('string', {})
do ('Lua').key = 1 end;
"
runtime error: invalid memory address or nil pointer dereference
stack traceback:
        <string>:3: in main chunk
        [G]: ?

The same snippet executed by Lua 5.1 reports an error "attempt to index a string value":

$ lua5.1 -e "
debug.setmetatable('string', {})
do ('Lua').key = 1 end;
"
lua5.1: (command line):3: attempt to index a string value
stack traceback:
        (command line):3: in main chunk
        [C]: ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions