GithubHelp home page GithubHelp logo

tstl-lurker's Introduction

TSTL Lurker

Declarations for lurker, a small module which automatically hotswaps changed Lua files in a running LÖVE project.

Command Description
yarn add -D tstl-lurker Install these declarations
yarn add rxi/lume rxi/lurker Install Lurker
tstl -p tsconfig.json --watch Transpile and continue to transpile changed .ts files
love /path/to/game/directory Run the game. Make sure lurker.update() is called

Upon installation these declarations can be linked to a tsconfig.json file.

{
    "compilerOptions": {
        "types": [
            "tstl-lurker"
        ]
    }
}

And used within any .ts file.

import lurker = require("lurker");
// this import style is not available in esnext

lurker.preswap = (f) => f === "lualib_bundle.lua";
// do NOT hotswap lualib_bundle.lua, lurker can't hotswap this

lurker.path = "./entities";
lurker.quiet = false;

love.update = () => {
    lurker.update();
};

Make sure to append ";./node_modules/?/?.lua" to your package.path in a conf.ts file (this is run first) to assist where Lua looks for modules.

package.path += ";./node_modules/?/?.lua";

tstl-lurker's People

Contributors

hazzard993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tstl-lurker's Issues

Error when trying to reload TypeScript files

Hey there -- I realize this is obviously isn't the fault of your type definitions, but I'm getting an odd error when I try to use Lurker and modify my TypeScript files (while running tstl -p tsconfig.json --watch):

[lurker] Hotswapping 'conf.lua'...
[lurker] Swapped 'conf.lua' in 0.00053299999999989 secs
[lurker] Hotswapping 'guy.lua'...
[lurker] Swapped 'guy.lua' in 0.001142 secs
[lurker] Hotswapping 'lualib_bundle.lua'...
[lurker] Failed to swap 'lualib_bundle.lua' : node_modules/lume/lume.lua:693: table index is nil

Oddly, if I modify the output Lua files directly, things seem to work fine (more or less -- it doesn't crash, but it doesn't always seem to hotswap correctly).

Do you happen to have any insights about what might be happening?

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.