Returns the width and height (respectively) of the game window in pixels.
Returns the return value of the mod with the given name.
If you don't return anything in your init.lua
file, this function will return nil
. This will often look like return MyMod:new()
at the end of your file. See the Lua documentation for info about how classes can be implemented in Lua.
Returns the singleton for the given type name if it exists, otherwisenil
.
A singleton is the sole instance of a type, often used for global operations.
Returns the current CET build's commit hash.
Returns whether the specified .archive
file is present in the archive/pc/mod
folder
This technique can be used to detect whether your Redscript mod is present, from CET side. It can be useful if you are writing a mod with both languages for some reason.
You can declare a static method without a body. It will do nothing:
You can now test whether this method is defined from CET side using this:
You can call IsRedscriptDetected()
and it will return true
when your Redscript method is detected (meaning your Redscript mod is loaded) or false otherwise.
Don't forget to change NameOfYourMod
in both cases.
Prints one or more objects to the CET Console and CET Console Logs file. Multiple objects will be printed separated by a space.
Write a string in the Individual Mod Logs file, eg, <
>/mods/my_mod/my_mod.log
.
There are several spdlog
methods, all are identical and have the same output:
spdlog.debug()
spdlog.trace()
spdlog.info()
spdlog.warning()
spdlog.error()
spdlog.critical()
It is recommended to use spdlog.info(tostring(my_var))
to make sure the variable is compatible, as boolean
, interger
and other types will throw an error.
Returns a JSON-ish string with details about the members of obj
:
Type name
Instance functions
Static functions
Properties
The listed functions include their signatures.
If detailed
is true, function descriptions will include the function's full name hash, short name, and short name hash.
obj
must be an instance of a wrapped game type, such as PlayerPuppet
which is returned by Game.GetPlayer()
. DumpAllTypeNames() will dump the names of all such types.
Returns the game's internal debug string for the given object. This string displays the object's properties and their values.
Beware that this string probably won't have any line breaks, so it's more advisable to open <
>/scripting.log
in a text editor with line wrapping to view the output of this function.
Like Dump(), but takes a type name rather than an object instance. Use DumpAllTypeNames() to get a list of all types.
Dump all type names to <
>/cyber_engine_tweaks.log
and prints to the CET Console the number of types dumped.
Miscellaneous functions useful for debugging and getting special objects and info.