Skip to content

Global functions get transpiled with a nil first argument #1

@r-o-b-o-t-o

Description

@r-o-b-o-t-o

It seems that some functions that are available from the global scope are incorrectly transpiled to Lua.
For example:

const map = GetMapById(1);
print(map.GetName());

transpiles to

local map = GetMapById(nil, 1)
print(
    map:GetName()
)

notice the nil before the 1, which causes an error: bad argument #1 to 'GetMapById' (number expected, got nil)

Same behavior with

const query = CharDBQuery("...");

which transpiles to

local query = CharDBQuery(nil, "...")

and therefore gives the error bad argument #1 to 'CharDBQuery' (string expected, got nil)

I'm using the following versions:

  • @azerothcore/eluna-ts-lib: ^1.0.13
  • typescript: 4.2.4
  • typescript-to-lua: ^0.39.3
  • Node v14.16.0

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