[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why not Just PHP-stupid include?
- From: Elias Hogstvedt <eliashogstvedt@...>
- Date: Wed, 19 Oct 2011 01:06:24 +0200
You can write the preprocessor yourself by using stock Lua functions. I've written a preprocessor and it's under 150 lines, but I wrote it for #define and not #include, but it could easily be changed. And I guess it would be less than 150 lines if it only were to support #include. For a relative path, you can use debug.getinfo(num).src and compare it against a base Lua folder of your choice. But once you have a preprocessor going you might as well add #define to it for fun if it doesn't harm! :)
I don't know if a Lua solution to issues like these should be mentioned (one of my first replies here). From what I can tell you want this in stock Lua, but I'm assuming you are in charge of the application using Lua.
I personally don't think Lua should have this. A preprocessor doesn't suit Lua well, and nor does define really due to how dynamic Lua is.