Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/n1ghtthef0x/figura-ts

Lua Types for the Minecraft Mod Figura
https://github.com/n1ghtthef0x/figura-ts

figura lua minecraft types typescript typescript-to-lua

Last synced: about 1 month ago
JSON representation

Lua Types for the Minecraft Mod Figura

Awesome Lists containing this project

README

        

# figura-ts

Lua Types for the Minecraft Mod [Figura](https://figuramc.org/) with [TypeScriptToLua](https://typescripttolua.github.io/)

## Setup

Install package via any package manager

```sh
npm install -D figura-ts
```

Create a `tsconfig.json` with at least these options:

```json
{
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext"]
},
"tstl": {
"luaTarget": "5.2",
"luaLibImport": "require"
}
}
```

Put this line inside the source directory somewhere:

```typescript
///
```

Now you can code just like with lua, you can then compile the code with `tstl` and use it

## Limitations

### accessing `LuaEvent` from `events.entity_init`, `events.tick`, etc

In lua you can access the `LuaEvent` object from the lowercase named events but in figura-ts you can only access them from the uppercase named events (`ENTITY_INIT`, `TICK`, etc.)

```typescript
events.entity_init.register(someFunc,someName) // Does not work
events.ENTITY_INIT.register(someFunc,someName) // works
```

### creating ping functions

For the time being you have to cast the parameters of your ping function until I figure out how not to do that

```typescript
pings.somePingFunction = function(arg)
{
someFunction(arg as boolean)
}
```

## Changelog

- `1.0.0`
- inital version
- `1.0.1`
- finished current GitHub transpile
- renamed some functions/types to fit GitHub code
- fixed some functions/namepspaces

## License

This project is licensed under [MIT License](./LICENSE)