1, Is it possible to access functions or variables in another file? Through require directive or something else?
2, Any method to iterate all the custom variables and functions in a scenerio?
3, How to restart mtn fortress with console, without deleting the data.??? file in save file?
Or link to the answers directly.
Thanks.
Multi file problem
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: Multi file problem
In this mod, I've stored different functions and variable definitions in an extra file (common.lua):yagaodirac wrote: ↑Sun Jun 28, 2020 2:30 pm1, Is it possible to access functions or variables in another file? Through require directive or something else?
Code: Select all
return function ()
local common = {}
------------------------------------------------------------------------------------
-- Read startup settings
common.get_startup_settings= function()
local f_name = "common.get_startup_settings()"
if settings and settings.startup then
common.long_reach = settings.startup["GCKI-long_reach"].value
common.debug_in_log = settings.startup["GCKI-debug_in_log"].value
else
common.error("Startup settings are not available!", f_name)
end
end
[…]
return common
end
Code: Select all
GCKI = require('common')
[…]
GCKI.get_startup_settings()
[…]
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!