-
Notifications
You must be signed in to change notification settings - Fork 49
Home
Afforess edited this page Apr 6, 2016
·
12 revisions
Welcome to the Factorio Standard Library!
The Factorio Standard Library is a project to bring Factorio modders high-quality, commonly-required utilities and tools that developers have been often copying around, remixing, and rewriting poor quality copies of. Basic tools like logging, math calculations, and position or area manipulation, which involve repeated drudgery and are commonly reproduced in high-quality, documented form in the Factorio Standard Library.
- Download the latest release of the stdlib
- Unpack the archive, and copy the
stdlib/
directory into your base mod directory - In your
control.lua
or other lua classes, you can import the stdlib classes you need. For example, using the logger:
require 'stdlib/log/logger'
require 'defines'
LOGGER = Logger.new('example-mod-name')
script.on_event(defines.events.on_tick, function(event)
if event.tick % 600 == 0 then
LOGGER.log("An example log message!")
end
end)
In factorio, mod log output will be in %appdata%\factorio\script-output\logs
(on windows), or ~/.factorio/script-output/logs
(on OSX or Linux).