mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 13:42:59 +00:00 
			
		
		
		
	
		
			
				
	
	
	
		
			12 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			12 KiB
		
	
	
	
	
	
	
	
			
				module: [kind=reference] feature_compat
			
		
	Lua 5.2/5.3 features in CC: Tweaked
CC: Tweaked is based off of the Cobalt Lua runtime, which uses Lua 5.2. However, Cobalt and CC:T implement additional features from Lua 5.2 and 5.3 (as well as some deprecated 5.0 and 5.1 features). This page lists all of the compatibility for these newer versions.
Lua 5.2
| Feature | Supported? | Notes | 
|---|---|---|
| goto/labels | ✔ | |
| _ENV | ✔ | |
| \zescape | ✔ | |
| \xNNescape | ✔ | |
| Hex literal fractional/exponent parts | ✔ | |
| Empty statements | ✔ | |
| __lenmetamethod | ✔ | |
| __ipairsmetamethod | ❌ | Deprecated in Lua 5.3. ipairsuses__len/__indexinstead. | 
| __pairsmetamethod | ✔ | |
| bit32library | ✔ | |
| collectgarbageisrunning, generational, incremental options | ❌ | collectgarbagedoes not exist in CC:T. | 
| New loadsyntax | ✔ | |
| loadfilemode parameter | ✔ | Supports both 5.1 and 5.2+ syntax. | 
| Removed loadstring | ❌ | |
| Removed getfenv,setfenv | 🔶 | Only supports closures with an _ENVupvalue. | 
| rawlenfunction | ✔ | |
| Negative index to select | ✔ | |
| Removed unpack | ❌ | |
| Arguments to xpcall | ✔ | |
| Second return value from coroutine.running | ✔ | |
| Removed module | ✔ | |
| package.loaders->package.searchers | ❌ | |
| Second argument to loader functions | ✔ | |
| package.config | ✔ | |
| package.searchpath | ✔ | |
| Removed package.seeall | ✔ | |
| string.dumpon functions with upvalues (blanks them out) | ❌ | string.dumpis not supported | 
| string.repseparator | ✔ | |
| %gmatch group | ❌ | |
| Removal of %zmatch group | ❌ | |
| Removed table.maxn | ❌ | |
| table.pack/table.unpack | ✔ | |
| math.logbase argument | ✔ | |
| Removed math.log10 | ❌ | |
| *Lmode tofile:read | ✔ | |
| os.executeexit type + return value | ❌ | os.executedoes not exist in CC:T. | 
| os.exitclose argument | ❌ | os.exitdoes not exist in CC:T. | 
| istailcallfield indebug.getinfo | ❌ | |
| nparamsfield indebug.getinfo | ✔ | |
| isvarargfield indebug.getinfo | ✔ | |
| debug.getlocalnegative indices for varargs | ❌ | |
| debug.getuservalue/debug.setuservalue | ❌ | Userdata are rarely used in CC:T, so this is not necessary. | 
| debug.upvalueid | ✔ | |
| debug.upvaluejoin | ✔ | |
| Tail call hooks | ❌ | |
| =prefix for chunks | ✔ | |
| Yield across C boundary | ✔ | |
| Removal of ambiguity error | ✔ | |
| Identifiers may no longer use locale-dependent letters | ✔ | |
| Ephemeron tables | ❌ | |
| Identical functions may be reused | ❌ | Removed in Lua 5.4 | 
| Generational garbage collector | ❌ | Cobalt uses the built-in Java garbage collector. | 
Lua 5.3
| Feature | Supported? | Notes | 
|---|---|---|
| Integer subtype | ❌ | |
| Bitwise operators/floor division | ❌ | |
| \u{XXX}escape sequence | ✔ | |
| utf8library | ✔ | |
| removed __ipairsmetamethod | ✔ | |
| coroutine.isyieldable | ✔ | |
| string.dumpstrip argument | ✔ | |
| string.pack/string.unpack/string.packsize | ✔ | |
| table.move | ✔ | |
| math.atan2->math.atan | 🔶 | math.atansupports its two argument form. | 
| Removed math.frexp,math.ldexp,math.pow,math.cosh,math.sinh,math.tanh | ❌ | |
| math.maxinteger/math.mininteger | ❌ | |
| math.tointeger | ❌ | |
| math.type | ❌ | |
| math.ult | ❌ | |
| Removed bit32library | ❌ | |
| Remove *fromfile:readmodes | ✔ | |
| Metamethods respected in table.*,ipairs | ✔ | 
Lua 5.0
| Feature | Supported? | Notes | 
|---|---|---|
| argtable | 🔶 | Only set in the shell - not used in functions. | 
| string.gfind | ✔ | Equal to string.gmatch. | 
| table.getn | ✔ | Equal to #tbl. | 
| table.setn | ❌ | |
| math.mod | ✔ | Equal to math.fmod. | 
| table.foreach/table.foreachi | ✔ | |
| gcinfo | ❌ | Cobalt uses the built-in Java garbage collector. | 
