Skip to content

Don't Disable UTF-8 Module on Lua < 5.3 #1796

@MikuAuahDark

Description

@MikuAuahDark

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Annotations, Libraries

Expected Behaviour

local utf8 = require("utf8") gives UTF-8 function definitions regardless of Lua version.

Actual Behaviour

local utf8 = require("utf8") only gives UTF-8 function definitions if Lua runtime version is 5.3 or later.

Reproduction steps

Reproducible with one line of code.

local utf8 = require("utf8")

On Lua runtime < 5.3, utf8 is unknown.

Additional Notes

Some Lua < 5.3 environments (e.g. love) provides Lua 5.3 utf8 module but this must be loaded separately using require.

It's reasonable to have utf8 in global namespace when user runtime is set to Lua 5.3 or later, but don't put the utf8 module in Lua 5.3 check, a.k.a. allow it to be loaded manually using require on earlier Lua version.

Log File

N/A, easily reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions