Skip to content

Can Nelua's preprocessor/macro be used alone (as a Lua library)? #189

Answered by edubart
MuhammedZakir asked this question in Q&A
Discussion options

You must be logged in to vote

It is possible with lot of limitations and quirks, so I don't recommend that, thus I would say no.

Nelua can compile back to Lua, this allow using its preprocessor and type checking for Lua, however the Lua backend is not maintained anymore, it was done in the early days for parsing and testing purposes. Nowadays the Lua backend is unmaintained and lots of stuff will give compile time errors.

Here is an example of you asked:

## MYCONFIG = true
## if MYCONFIG then
  print 'hello from lua'
## end
$ nelua test.nelua --generator lua -o test.lua
$ cat test.lua 
-- Generated by Nelua 0.2.0-dev
-- Compile Hash: mFdHCahpdZ8woTtsei8ecRHJehC

print("hello from lua")
$ lua test.lua
hello from lua

So…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by edubart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants