This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Admicos's profile picture

luapp -- A Lua Preprocessor

Started by Admicos, 19 October 2016 - 02:48 PM
Admicos #1
Posted 19 October 2016 - 04:48 PM
luapp is a Lua preprocessor. Yeah.

USAGE
[indent=1]luapp <args> <filename>[/indent]

DOCS
[indent=1]Can be found here[/indent]

DOWNLOADS

[indent=1]pastebin: Y39vjirG (requires getopt)[/indent]
[indent=1]packman: admicos/luapp (recommended, will get getopt with it)[/indent]
[indent=1]git: https://github.com/admicos/luapp (also includes non-computercraft versions)[/indent]
Edited on 11 November 2016 - 04:20 PM
Admicos #2
Posted 05 November 2016 - 07:16 AM
luapp has been updated to 1.1.0!, new additions:
  • –pp:ifdef definition: Similar to a ignore zone, but ignores if "definition" is not defined
  • –pp:ifndef definition: Reverse of "ifdef"
  • –pp:if "lua expression": Similar to a ignore zone but ignores if "lua expression" returns false
  • –pp:ifn "lua expression": Reverse of "if"
  • –pp:else: Reverses a ignore zone.
  • Fixed preprocessor commands running on ignore zones.
Here is a example of the ifs

--pp:if 1 == 1
print("1 equals 1!")
--pp:ignoreend

--pp:define DO_PRINT_THAT true

--pp:ifdef DO_PRINT_THAT
print("dpt is defined")
--pp:ignoreend

--yes, ifs also allow the defines with the lua code.

--pp:if DO_PRINT_THAT
print("dpt on")
--pp:else
print("dpt off")
--pp:ignoreend
Edited on 05 November 2016 - 06:36 AM
Admicos #3
Posted 05 November 2016 - 06:15 PM
luapp has been updated to 1.2.0, which now includes:
  • The –pp:include command will now look at the following directories for includeable files:
[indent=2]/etc/luapp/include[/indent]
[indent=2]Current directory[/indent]
[indent=2]Root of the filesystem[/indent]

/etc/luapp/include is for global includes that you can redistribute with your API, current directory was the default and the root of the filesystem is just an extra.
Edited on 05 November 2016 - 05:36 PM
Admicos #4
Posted 07 November 2016 - 03:44 AM
luapp will (with a optional setting) now work with the official lua5.1 cli so you can use it for non-Computercraft programs!
Admicos #5
Posted 11 November 2016 - 05:11 PM
luapp has been updated to 1.3.0, changelog here