C++ macros inside mta.
include "scriptName"- load specified file with macro supportignore [n]- ignore next line, or N next lines,ignore 10will ignore next 10 linesdefine name value- set value under name.precompile name value- same as above but value become executed and result is stores under name.undef name- remove variable.ifdef name- check if variables is in use.ifndef name- check if variables isn't used yet.if condition- skip chunk of code if result of condition equal false.else- if condition was false.endif- end of if.
I recommend to set uppercase name.
Macros starting with # char at start.
#define A 1
#define B 1
#precompile C A+B
print(C)final code will be: print(2)
#define ADD1(A,B) A+B
#precompile ADD2(A,B) A+B
print(ADD1(1,2)) -- print(1+2)
print(ADD2(1,2)) -- print(3)Simply add one line to your code:
loadstring(exports.prepocessor:install())()where prepocessor is resource name.
Then you can use dofile function that accept filename argument, example dofile("test.lua") will load test.lua with macro support