Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
bad at vijya

LuaComp - Includes, macros, and more!

Recommended Posts

Wow, isn't it annoying to write EEPROMs? Don't you hate how messy they are?

Well, I have the utility for you! LuaComp!


A general purpose Lua preprocessor and minifier.


To build, either execute luapreproc or luacomp on src/init.lua


Execute luapreproc init.lua ../luacomp.lua


Execute luacomp init.lua -xO ../luacomp.lua

NOTE: Do not use a minifier, it breaks argparse!


Merging Lua source files

-- myfile.lua
local my_lib = {}

function my_lib.hello_world()
  print("Hello, world!")
-- main.lua
--#include "my_file.lua"

Getting enviroment variables

print("This was compiled in the shell "..$(SHELL))


@[[function my_macro(a, b)]]
print("Hello, @[{a}]. Your lucky number is @[{b}].")

@[[my_macro("world", 7)]]
@[[my_macro("user", 42)]]
@[[my_macro("Earth", 0)]]
@[[my_macro("Satna", 666)]]
@[[my_macro(os.getenv("USER"), os.getenv("UID")]]

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.