Lua
The first and most powerful coding language implement into FicsIt-Networks is Lua. The reasons for using Lua instead of f.e. Python is simple. Lua is made for it. The whole Lua architecture is made with use in other programs in mind, that’s like the whole purpose of Lua. So it is fast and easy to implement and also has a decent runtime speed. The simple syntax also makes it a great choice for beginners.
Visit the Lua Website to learn more.
Useful Notes
It may seem odd that things like the external libraries, the additional runtime functions and the APIs are not shown in the reflection viewer. The reflection viewer is intended to only show the contents of the reflection system and not as full documentation system. Later on we may implement more other ways to code, like visual scripting. These implementations will work different and can use Lua external libraries and do stuff like the APIs differently. Because of this, this information is only available right now in the online documentation and not in-game. But because of the nature of the reflection system, we are able to show all functions and properties of the system in the reflection viewer because these interactions will work in any implementation, that’s the main purpose of the reflection system.
External Libraries
The following list contains all available standard Lua libraries, non-standard libraries if they are reimplemented you can see the changes.
-
math
-
table
-
string
-
debug (parts of it for error handling)
Reflection API
The Reflection System of FicsIt-Networks is the main way how objects like machines are exposed to the runtime.
Classes (Class-Library)
Because you may need to get Object Types without first an object (e.g. when using component.findComponent with a type),
FIN provides the classes-Library.
You can get access to classes by indexing the library with the exact class name of the class you want to get.
classes.GPUT1
classes["StorageContainer"]
local someClassName = "Assembler"
classes[someClassName]
You can use them directly in functions that take in class types.
local gpu = computer.getPCIDevices(classes.GPUT1)
local containerIDs = component.findComponent(classes.StorageContainer)
When using the syntax without the Subsequence/Index-Operator, the In-Game editor automatically checks if the class type is found & valid and underlines it with green or red. Additionally you can double-click onto that text to directly open the reflection viewer.
Structs (Structs-Library)
Similar to classes, structs are exposed using the structs library.
But this library does not provide the Struct-Types, instead you can index a function that allows the construction of that type.
local vec1 = structs.Vector(0,1,2)
local vec2 = structs.Vector{z = 5, x = 3, y = 4}
local vec3 = vec1 + vec2