Learn the API From the Log
A practical way to learn the Foxel scripting API is by watching the calls Foxel writes to the log while you work.
Many actions performed in the user interface produce corresponding API calls, including the parameters Foxel used.
Why This Matters
API documentation is useful, but it can still be hard to know which function to call for a real task.
Foxel makes this easier by logging many of the API calls it uses when you perform actions in the interface.
This means you can often learn the scripting version of an action by doing it manually first.
Where API Calls Are Logged
API calls are written to:
Documents\Foxel\Log\system.logThey are also shown in the console window.
Use either location to inspect the calls Foxel writes while you work.
What The Log Gives You
Many actions performed in the user interface produce corresponding API calls, including the parameters used.
That means you can often learn the scripting equivalent of a manual action by:
- Doing the action in Foxel.
- Checking the log.
- Finding the API call Foxel used.
- Adapting that call in your own script.
This is useful because it connects the visible interface action to the Lua API call behind it.
Example
Foxel may write a line like this:
2025-06-19 15:01:57 API : FxFile.Open(111, "Asset1");The relevant part for scripting is the function call after API :
FxFile.Open(111, "Asset1");This shows that Foxel called the function Open from the FxFile module with two parameters.
The timestamp and log category are useful for reading the log, but they are not part of the script call.
Using Modules With Require
Before calling functions from a module in your own script, you need to load that module with require.
For example:
FxFile = require "FxFile"After that, you can call functions from that module in your script:
FxFile.Open(111, "Asset1");Use the module name from the logged API call as a clue for which module needs to be required.
Why This Workflow Is Useful
Reading logged API calls is a practical way to understand how the Foxel API works in real workflows.
This is especially helpful when:
- You already know how to do something in the UI.
- You want to automate that task.
- You are not yet sure which API function to use.
- You want to see the parameters Foxel uses for a specific action.
Instead of guessing the API call from scratch, you can let Foxel show you what it used.
A Practical Learning Workflow
A useful workflow is:
- Open the log or console.
- Perform one clear action in Foxel.
- Find the newest
APIline. - Copy the function call portion.
- Add the required module with
require. - Adapt the parameters for your script.
Work with one action at a time so the log stays easy to read.
What To Remember
- Foxel writes API calls to the system log and console.
- The log file is at
Documents\Foxel\Log\system.log. - Many UI actions produce corresponding API calls.
- The relevant part is the function call after
API :. - Timestamps and log labels are not part of the script call.
- Modules must be loaded with
requirebefore you call their functions. - The log is one of the best practical ways to learn Foxel scripting.