• Stars
    star
    258
  • Rank 152,284 (Top 4 %)
  • Language
    Lua
  • License
    MIT License
  • Created about 10 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Auto-swaps changed Lua files in a running LÖVE project

Lurker

A small module which automatically hotswaps changed Lua files in a running LÖVE project.

Installation

Drop the lurker.lua and lume.lua files into an existing project and add the following line inside the love.update() function:

require("lurker").update()

Lurker will automatically detect changed files and hotswap them into the running project.

Additional Functionality

To more easily make use of additional functionality, the lurker module can be set to a variable when it is required into the project:

lurker = require "lurker"

lurker.scan()

As opposed to using the lurker.update() function -- such to avoid the overhead of repeatedly polling for file changes -- you can instead opt to trigger a scan of the directory by calling lurker.scan() manually. If the scan detects any changes a hotswap is performed.

lurker.preswap

lurker.preswap can be set to a function. This function is called before a hotswap occurs and is passed the name of the file which will be swapped. If the function returns true then the hotswap is canceled.

lurker.preswap = function(f) print("File " .. f .. " swapping...") end

lurker.postswap

lurker.postswap can be set to a function. This function is called after a hotswap occurs and is passed the name of the file which was swapped.

lurker.postswap = function(f) print("File " .. f .. " was swapped") end

lurker.protected

Dictates whether lurker should run in protected mode; this is true by default. If protected mode is disabled then LÖVE's usual error screen is used when an error occurs in a LÖVE callback function; if it is enabled then lurker's error state (which continues watching for file changes and can resume execution) is used. Changes to this variable should be made before any calls to lurker.update() are made.

lurker.quiet

Dictates what should happen if lurker tries to load a file which contains a syntax error. If it is false then lurker's error screen is shown until the syntax error is fixed; if it is true the error message is printed to the console and the program continues. lurker.quiet is false by default.

lurker.interval

The interval in seconds for how often the scan of the directory is performed. This is .5 by default.

lurker.path

The directory which is scanned for changes. This is . (The project's root) by default.

More Repositories

1

lite

A lightweight text editor written in Lua
Lua
7,254
star
2

microui

A tiny immediate-mode UI library
C
3,003
star
3

log.c

A simple logging library implemented in C99
C
2,361
star
4

json.lua

A lightweight JSON library for Lua
Lua
1,689
star
5

dyad

Asynchronous networking for C
C
1,432
star
6

fe

A tiny, embeddable language implemented in ANSI C
C
1,262
star
7

lume

Lua functions geared towards gamedev
Lua
908
star
8

classic

Tiny class module for Lua
Lua
773
star
9

lovedos

A framework for making 2D DOS games in Lua
C
659
star
10

map

A type-safe hash map implementation for C
C
553
star
11

vec

A type-safe dynamic array implementation for C
C
426
star
12

microtar

A lightweight tar library written in ANSI C
C
407
star
13

flux

A fast, lightweight tweening library for Lua
Lua
354
star
14

lite-plugins

Plugins for the lite text editor
Lua
342
star
15

ini

A tiny ANSI C library for loading .ini config files
C
308
star
16

log.lua

A tiny logging module for Lua
Lua
287
star
17

lovebird

A browser-based debug console for LÖVE
Lua
282
star
18

aq

A lightweight framework for creating audio toys
C
235
star
19

kit

A tiny library for making small games with big pixels
C
231
star
20

uuid4

A tiny C library for generating uuid4 strings
C
207
star
21

sfd

A small C library for opening a file dialog
C
165
star
22

sandbird

A tiny embeddable HTTP server written in C89
C
164
star
23

cmixer

Portable ANSI C audio mixer for games
C
163
star
24

aria

A tiny, embeddable lisp-shaped language implemented in C89
C
162
star
25

juno

Framework for making 2D games with chunky pixels in Lua
C
160
star
26

tick

Lua module for delaying function calls
Lua
115
star
27

autobatch

Small LÖVE module to automate the use of SpriteBatches
Lua
103
star
28

dmt

Dynamic memory tracker for C
C
99
star
29

lite-colors

Colors themes for the lite text editor
Lua
96
star
30

cembed

A small utility for embedding files in a C header
C
90
star
31

doq

A small tool for creating single-file html documents
C
80
star
32

lovebpm

A LÖVE library for syncing events to the BPM of an audio track
Lua
73
star
33

coil

A tiny cooperative threading module for Lua
Lua
72
star
34

shash

A simple, lightweight spatial hash for Lua
Lua
64
star
35

console

A console plugin for the lite text editor
Lua
57
star
36

atlas

A small utility for generating a texture atlas
C
40
star
37

rxi.github.io

HTML
17
star
38

gifwriter

A Nim library for writing animated GIFs
C
17
star
39

cmixer_sdl2-nim

Tiny Nim library for using cmixer with sdl2
Nim
3
star
40

cmixer-nim

Nim wrapper for cmixer, A lightweight audio mixer for games
C
3
star
41

crate

2
star