Skip to content

1.0.0 Comparing 'string' with number, but old gopher-lua printed a proper number after tonumber syntax #423

Closed
@djonskin

Description

@djonskin

You must post issues only here. Questions, ideas must be posted in discussions.

  • GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
  • GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.

Please answer the following before submitting your issue:

  1. What version of GopherLua are you using? : newest version from git pull
  2. What version of Go are you using? : 1.19.5
  3. What operating system and processor architecture are you using? : Windows 10 64 bit on AMD
  4. What did you do? : Tried running Ikemen GO, which depends on gopher-lua v0.0.0-20220504180219-658193537a64.
  5. What did you expect to see? : https://static.wikia.nocookie.net/mugen/images/6/66/IKEMEN_GO_TitleScreen.png/revision/latest/scale-to-width-down/320?cb=20210814031134 Normal Ikemen-GO operation.
  6. What did you see instead? : https://user-images.githubusercontent.com/106702560/211409973-b611ba28-e9da-4a48-8b68-267d58b976f1.png I ran into an attempt at comparing string-to-number error regarding syntax. The program crashed before I got into it. In the end, my issue was resolved at Ikemen GO's repository after much investigation. My solution was duct taped together in a PR over there.

A performed test here:

local a, b, c = "1", "3", "1"
a, b, c= tonumber(a), tonumber(b) or a, tonumber(c)
print(a, type(a), b, type(b), c, type(c))

printed
1, number, 3, string, 1, number
and the expected type for all 3 arguments should be equal to number.

It seemed I was getting my start crash result as of a few weeks ago with gopher-lua's 1.0.0 update. In the end, I was only suggested to either downgrade the gopher-lua version I was using to v0.0.0-20220504180219-658193537a64, and/or bring it up over here, but this team should certainly know.

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