FMTK Lua API
FMTK module
- fmtk.hook(event, id, callback)
register a hook
- Parameters:
event (
number
) – and Event enum valueid (
str
) – a unique id to refer to this hook ascallback (
function
) – function signature depends on the event
- fmtk.unhook(event, id)
unregister a hook
- Parameters:
event (
number
) – and Event enum valueid (
str
) – the unique id of the hook
- fmtk.get_fmtklua_version()
get the version of FMTK SDK that was used to build FMTKLua
- Returns:
version
- Return type:
- fmtk.run_command(cmd)
run a command string
- Parameters:
cmd (
str
) – The command string you would normally type into the command palette- Returns:
success
- Return type:
boolean
- fmtk.register_command(name, callback)
register command
- Parameters:
name (
str
) – The name of the command. The abbreviated version of the command name will be generated from the capital letters taken in left to right order.callback (
fun(list[str]):boolean
) –
- fmtk.unregister_command(name)
unregister a command
- Parameters:
name (
str
) – The name of the command
- class fmtk.event
Event enum
- INITIALIZE: number
This hook is called before the game’s WinMain entry point. At this point the ScriptManager is unavailable so calls to command functions will fail. This will always be the first hook to run.
- TICK: number
This hook is called once per execution of the game’s CoreMainLoop function.
- SCRIPT_MANAGER_INITIALIZE: number
This hook is called once the ScriptManager is initialized. This is the first legal place to call the register command function. None of the FUEL commands have been registered yet so RunCommand with them will fail.
- SHUTDOWN: number
This hook is called before the FMTK dll is unloaded. This will always be the last hook to run.
- class fmtk.fs
FMTK file system module
- static alias(oldPath, newPath)
alias a file path
- Parameters:
oldPath (
str
) – The old path relative to the FUEL working directory or absolute.newPath (
str
) – The new path relative to the FUEL working directory or absolute.
- static unalias(oldPath)
unalias a file path
- Parameters:
oldPath (
str
) – The old path relative to the FUEL working directory or absolute.
- static get_mods_directory_path()
get the mods directory path
- Returns:
absolute mods directory path
- Return type:
str
- static get_current_file_path()
get the current lua file path
- Returns:
absolute current lua file path
- Return type:
str
- class fmtk.log
FMTK log module
- static trace(source, msg)
log a trace message. This is a message for an FMTK developer. Exclude it from release builds.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –
- static debug(source, msg)
log a debug message. This is a message for a mod developer.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –
- static info(source, msg)
log an info message. This is a message for a user that everything is fine and no action is necessary.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –
- static warn(source, msg)
log a warning. This is a message for a user that something may be wrong but no action is necessary.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –
- static error(source, msg)
log an error. This is a message for a user that something is wrong but no action is necessary. A recoverable error.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –
- static critical(source, msg)
log a critical error. This is a message for a user that something is wrong and action is necessary. An unrecoverable error.
- Parameters:
source (
str
) – This should be the name of the mod calling the function.msg (
str
) –