Giter Club home page Giter Club logo

eluna-ts's Introduction

Eluna TS

Eluna-TS is a system that uses TypeScriptToLua to compile Lua files compatible with the Eluna Engine

This project is composed by:

  • ✔️ A pre-configured workspace compatible with VSCode to compile your sources
  • ✔️ The deps/eluna-ts-definitions which adds Eluna definition files to Typescript allowing proper type-checking and intellisense feature
  • ✔️ The deps/eluna-ts-lib which must be included in your project to add needed methods and make it work on Eluna. It also adds some useful reusable Typescript classes and functions.

DISCLAIMER ⚠️: not all Typescript features are supported by Eluna-TS, the limitations are listed inside the documentation of the TypeScriptToLua project.

Demo

Typescript-to-lua-azerothcore

Last Eluna commit compatibility check

Installation (Without Docker)

If you don't have docker or you already have Nodejs install, you can just follow this guide to setup your environment by using Nodejs directly.

1. Requirements

NOTE: You can run the bash install-node.sh command to do it with an automatic script (it works on almost every OS with bash)

2. Install dependencies

  • Run npm install to install the required node dependencies

Installation (With Docker)

1. Requirements

2. Build and run the container

  • Run docker-compose up --build eluna-ts-dev

Configure your environment

Work in progress...

Unit tests

Unit tests coverage report

eluna-ts's People

Contributors

gh-action-bump-version avatar helias avatar yehonal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

eluna-ts's Issues

Bug: Register Server Events, Package Events do not accept an entry

This code should not expect an entry:

declare function RegisterServerEvent(
  this: void,
  entry: number,
  event: ServerEvents.SERVER_EVENT_ON_PACKET_RECEIVE,
  func: HookFunctionNoSelf<server_event_on_packet_receive_any>,
  shots?: number,
): (...args: any[]) => any;
declare function RegisterServerEvent(
  this: void,
  entry: number,
  event: ServerEvents.SERVER_EVENT_ON_PACKET_SEND,
  func: HookFunctionNoSelf<server_event_on_packet_send_any>,
  shots?: number,
): (...args: any[]) => any;

Env without Docker

Hi!

I'm really interested in this project but I haven't been able to run it properly, not much documentation on how to set up the environment when not using Docker.

Requesting a lil help,

Thanks!

Global functions get transpiled with a nil first argument

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.