We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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)
nil
1
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)
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
The text was updated successfully, but these errors were encountered:
I wonder if it's a bug of the underlying https://github.com/TypeScriptToLua/TypeScriptToLua
Sorry, something went wrong.
It might be, but I'm not sure how to pinpoint the exact cause
Found it! Static functions need a void argument in the type declaration. So for example you need to change CharDBQuery in global.d.ts from
CharDBQuery
global.d.ts
declare function CharDBQuery(sql: string): ElunaQuery;
to
declare function CharDBQuery(this: void, sql: string): ElunaQuery;
then it works properly 😄
No branches or pull requests
It seems that some functions that are available from the global scope are incorrectly transpiled to Lua.
For example:
transpiles to
notice the
nil
before the1
, which causes an error:bad argument #1 to 'GetMapById' (number expected, got nil)
Same behavior with
which transpiles to
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
The text was updated successfully, but these errors were encountered: