lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Subapplications in Lua

Open kjamsh opened this issue 7 years ago • 7 comments

Hi!

I'm writing a Lapis application without Moonscript, and wanted the benefits of subapplications in Lua. There are a few other issues on this topic, but they all suggest rather weak workarounds.

The app:match("/", require("actions.actionname")) method and require("actions.actionname")(app) method both make the app.lua file a bit smaller but they are not nearly as powerful as the @include versions.

In particular, I'm looking for the pure Lua way to get:

  • subapplication-specific before_filters
  • name and path prefixes

I've seen app:include around in talks and examples @leafo has given , but I haven't gotten the chance to make it work.

If this is possible, I'd be willing to make a PR on the docs if I knew how to do it. If it isn't, I guess I'll get to writing the plumbing to accomplish it myself.

Thanks in advance :)

kjamsh avatar Jan 10 '17 07:01 kjamsh

the lua-only subapplication support is currently missing from the code base! I didn't get a change to finish it up and push it in. I would like to do it soon though

leafo avatar Jan 11 '17 00:01 leafo

Thanks for letting me know! I'll make do until then. I appreciate the work you put into this framework, good luck.

kjamsh avatar Jan 11 '17 02:01 kjamsh

I miss this feature, I'm using only lua too and just noted that there is no support for subapplications. Is there any workaround to make app:include() work?

I think this should be reopened.

edubart avatar Jan 16 '17 18:01 edubart

I built my first lapis application using lua but now I have swapped to moonscript which I really enjoy. Its definitely worth giving a try. Generally I use vscode with moonscript plugin or vim for moonscript.

honewatson avatar Jan 17 '17 09:01 honewatson

Opening this up again until subapplications are available in lua

leafo avatar Jan 23 '17 19:01 leafo

Why the moonscript support include, but lua does not support?

uudiin avatar Jul 12 '17 11:07 uudiin

I created a sample project that adds sub-application support for Lua projects. Maybe it will help someone who finds this topic: https://github.com/VaiN474/lapis-lua-subapps

VaiN474 avatar Nov 27 '18 18:11 VaiN474