Skip to content

root-cli/MTA-Preprocessor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTA-Preprocessor

C++ macros inside mta.

instructions

  1. include "scriptName" - load specified file with macro support
  2. ignore [n] - ignore next line, or N next lines, ignore 10 will ignore next 10 lines
  3. define name value - set value under name.
  4. precompile name value - same as above but value become executed and result is stores under name.
  5. undef name - remove variable.
  6. ifdef name - check if variables is in use.
  7. ifndef name - check if variables isn't used yet.
  8. if condition - skip chunk of code if result of condition equal false.
  9. else - if condition was false.
  10. endif - end of if.

I recommend to set uppercase name.

Macros starting with # char at start.

Examples

#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)

How start working with this?

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

About

C++ macros inside mta.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 92.1%
  • C++ 6.8%
  • C 1.1%