lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 11-10-18 07:06 PM, Elias Hogstvedt wrote:
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.
Hi Elias

Thanks for feeding back on this. Is this how other languages like PHP do this? They are run through a preprocessor first? Is this why PHP is 3X -4X slower then Lua?
-Patrick