Skip to content

Support for unicode identifiers (on LuaJIT) #1117

@Cheatoid

Description

@Cheatoid

Problem description

Looks like TSTL is replacing unicode identifiers with some random gibberish (or is probably using unicode hexadecimal code-point format).

Practical example

A (game) engine may expect Lua script to define a global function called 开始 (Start), depending on whether or not the function is defined, an engine would invoke aforementioned function.
The problem is that (global) function name is changed during transpilation (from 开始 to _____5F00_59CB), which is obviously unwanted behavior in this scenario, because it means that function would never be executed.

Sample TypeScript snippet:

function 开始(): void { print("Starting..."); }
Expected Lua Actual Lua
function 开始() print("Starting...") end
function _____5F00_59CB() print("Starting...") end

Suggested solution

Unicode identifiers should be preserved when luaTarget is set to JIT (since this feature is only supported on LuaJIT of course, so far).

Justification

LuaJIT allows unicode in identifiers, TypeScript (and Javascript) allows them as well.
Therefore, there is really no reason why this should be left behind, or unsupported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions