Difference between revisions of "LUA"

From SC4D Encyclopaedia
Jump to navigation Jump to search
sc4e>JoeST
m (New page: LUA is a programming language ''more can be found [http://www.lua.org/ here]'' category:File Formats)
 
m (6 revisions imported)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
LUA is a programming language
+
{{MTS2}}
  
''more can be found [http://www.lua.org/ here]''
+
'''LUA''' is an imperative programming language, designed in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer Graphics Technology Group (Tecgraf) at PUC-Rio, the Pontifical University of Rio de Janeiro, in Brazil. "Lua" means "Moon" in Portuguese.  Lua is used in [[SimCity 4]] for the generation of help texts, creation of rewards, defining [[U-Drive-It]] missions, and other types of codes.
[[category:File Formats]]
+
 
 +
More information about Lua can be found on the [http://www.lua.org/ official site] and on [http://en.wikipedia.org/wiki/Lua_(programming_language) Wikipedia].
 +
 
 +
==Use in SimCity 4==
 +
Lua has many uses in SimCity 4, as mentioned above. The exact format used can vary depending on the use. The formats below are courtesy of [[People:Karybdis|Karybdis]].
 +
 
 +
Instance by: CRC24Polynomial = 0x01864cfb, CRC24Seed = 0x00b704ce, return (CRC24(from, false) | 0xFF000000)
 +
 
 +
The types of LUA files are:
 +
*[[LUAAdvice|Advice LUA's]]
 +
*[[LUAAdvisors|Advisor Definitions Script]]
 +
*[[LUADefs|LUA Definitions]]
 +
*[[LUAMission|Mission LUA Files]]
 +
*[[LUAObject]]
 +
*[[LUASystem|System LUA Files]]
 +
*[[LUATutorials|Tutorial Scripts]]
 +
 
 +
 
 +
==Binary LUA==
 +
The following format is for binary Lua scripts, and was developed by [[People:Quaxi|Quaxi]].
 +
 
 +
Here are the first things known about the .objLua and .globalObjLua:
 +
 
 +
===General Format===
 +
<pre>
 +
DWord: 1b 4c 75 61  (ID)
 +
Byte: Version   
 +
16-Bytes: Header
 +
    ---> Root "Function Block"
 +
</pre>
 +
 
 +
===Function Block===
 +
<pre>
 +
Dword: Character count n
 +
n-Byte: Name of the Function (null terminated)
 +
5-Byte: unknown
 +
Byte: argument Count
 +
Byte: unknown
 +
Byte: stack Size
 +
 +
12-Byte: 00
 +
 
 +
4-Byte: constant counter
 +
    ---> Loop Constant Block
 +
 +
4-Byte: functions counter
 +
    ---> Loop Function Block
 +
 
 +
4-Byte: instruction counter
 +
    ---> Loop Instruction Block
 +
</pre>
 +
 
 +
===Instruction Block===
 +
(a=Operand a, b=Operand b, c=Operand c, o=Opcode):
 +
 
 +
<pre>
 +
Dword: aaaa aaaa bbbb bbbb bccc cccc ccoo oooo   
 +
</pre>
 +
 
 +
This Document lists the available opcodes: http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/sblp2005.pdf
 +
 
 +
===Constant Block===
 +
<pre>
 +
Byte: ConstantType
 +
    ----> Constant Data
 +
</pre>
 +
 
 +
===List of Known Constant Data Types===
 +
 
 +
0x00 = Empty, Null -  This seems to mark an empty block
 +
0x03 = Number
 +
          DWord: Unknown
 +
          DWord: Unknown
 +
0x04 = Strings
 +
          DWord: Length n of the following PString
 +
          n-Bytes: Instruction Name, null-terminated
 +
 
 +
 
 +
{{navbox/FORMAT}}
 +
[[Category:File Formats/SC4]]
 +
[[Category:Modding]]
 +
[[Category:MTS2]]

Latest revision as of 18:54, 8 August 2019


LUA is an imperative programming language, designed in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer Graphics Technology Group (Tecgraf) at PUC-Rio, the Pontifical University of Rio de Janeiro, in Brazil. "Lua" means "Moon" in Portuguese. Lua is used in SimCity 4 for the generation of help texts, creation of rewards, defining U-Drive-It missions, and other types of codes.

More information about Lua can be found on the official site and on Wikipedia.

Use in SimCity 4

Lua has many uses in SimCity 4, as mentioned above. The exact format used can vary depending on the use. The formats below are courtesy of Karybdis.

Instance by: CRC24Polynomial = 0x01864cfb, CRC24Seed = 0x00b704ce, return (CRC24(from, false) | 0xFF000000)

The types of LUA files are:


Binary LUA

The following format is for binary Lua scripts, and was developed by Quaxi.

Here are the first things known about the .objLua and .globalObjLua:

General Format

	DWord: 1b 4c 75 61   (ID)
	Byte: Version    
	16-Bytes: Header
	    ---> Root "Function Block"

Function Block

	Dword: Character count n
	n-Byte: Name of the Function (null terminated)
	5-Byte: unknown
	Byte: argument Count
	Byte: unknown
	Byte: stack Size
	
	12-Byte: 00

	4-Byte: constant counter 
	    ---> Loop Constant Block
	
	4-Byte: functions counter
	    ---> Loop Function Block

	4-Byte: instruction counter
	    ---> Loop Instruction Block

Instruction Block

(a=Operand a, b=Operand b, c=Operand c, o=Opcode):

	Dword: aaaa aaaa bbbb bbbb bccc cccc ccoo oooo    

This Document lists the available opcodes: http://www.tecgraf.puc-rio.br/~lhf/ftp/doc/sblp2005.pdf

Constant Block

	Byte: ConstantType
	    ----> Constant Data

List of Known Constant Data Types

0x00 = Empty, Null -  This seems to mark an empty block
0x03 = Number
          DWord: Unknown
          DWord: Unknown
0x04 = Strings
          DWord: Length n of the following PString
          n-Bytes: Instruction Name, null-terminated