Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

TypeScriptToLua plugin that sets annotated local functions to nil

License

Notifications You must be signed in to change notification settings

thinknathan/tstl-nullify-function

Repository files navigation

tstl-nullify-function

TypeScriptToLua plugin that adds a statement to change local functions to nil if you annotate them with @nullify. This is only useful if you are using another plugin to inline the function, making the original function declaration redundant.

Example

/**
 * @nullify
 */
function foo() {
	...
}

Becomes:

local function foo
	...
end
foo = nil

Installation

Requires a modern version of TSTL. Tested on TSTL >= 1.22.0.

  1. Install this plugin
yarn add git+https://git@github.com/thinknathan/tstl-nullify-function.git#^1.0.0 -D
# or
npm install git+https://git@github.com/thinknathan/tstl-nullify-function.git#^1.0.0 --save-dev
  1. Add tstl-nullify-function to tstl.luaPlugins in tsconfig.json
{
	"tstl": {
		"luaPlugins": [
+			{ "name": "tstl-nullify-function" }
		],
	}
}

License

CC0