Uncommon Rares
Macro APILua Scripting

Language Reference

Supported Lua syntax and compiler exclusions.

Supported Subset

  • locals and script-level globals
  • if, elseif, else
  • while and repeat loops
  • numeric for loops
  • generic for loops over pairs(t) or ipairs(t)
  • break
  • table constructors, dot indexing, and bracket indexing
  • arithmetic, comparison, and logical operators
  • .. string concatenation
  • # length operator
  • top-level named functions with recursion capped by call depth
  • multiple assignment of value lists

Exclusions

FeatureDiagnosticSuggested alternative
MetatablesLUA_NO_METATABLESMetatables are not supported in macros.
CoroutinesLUA_NO_COROUTINESCoroutines are not supported in macros.
goto and labelsLUA_NO_GOTOGoto and labels are not supported in macros.
VarargsLUA_NO_VARARGSVarargs are not supported in macros.
Closures and nested functionsLUA_NO_CLOSURESDefine functions at the top level of the script.
Multiple return valuesLUA_NO_MULTI_RETURNMultiple return values are not supported in macros.
String pattern APIsLUA_NO_PATTERNSLua string pattern APIs are not supported in macros.
Method-call sugarLUA_NO_METHOD_CALLUse string.sub(s, ...) instead of s:sub(...).
Random number APIsLUA_NO_RANDOMMacros must be deterministic.
Host and environment APIsLUA_NO_HOSTHost and environment APIs are not supported in macros.
Dynamic Macro API dispatchLUA_DYNAMIC_APIMacro API functions must be called by static name.
Custom generic iteratorsLUA_UNSUPPORTED_ITERATORGeneric for loops must iterate with pairs(t) or ipairs(t).