Lately I was experimenting again with writing mods. With 0.13 it seems, that defines.lua is removed from data/core, but seems to be "silently" required - I think some internal stuff, nice.
My problem with this: I found the defines.lue super-practical, cause my IDE was able to interpret it in a way, that it showed me the definitions.
(For interested: I use PHPStorm on MacOS and just needed to set an include-path to /Applications/factorio.app/Contents/data )
Cause I'm a friend of automatic code verification I would like to use this again.
Does anybody have a good idea to do that?
defines.lua - where is it?
defines.lua - where is it?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: defines.lua - where is it?
build defines.lua variable file and put in ur path
http://lua-api.factorio.com/latest/defines.html
http://lua-api.factorio.com/latest/defines.html
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: defines.lua - where is it?
I'm not sure if there is a separate .lua file for it (if there is it will be in either core.zip or base.zip mods that are bundled with game).
You could possibly parse the documentation page linked in previous comment to generate a defines file? Or, easier, use serpent (already present in scripting env) to output the defines table in to a file on disk?
You could possibly parse the documentation page linked in previous comment to generate a defines file? Or, easier, use serpent (already present in scripting env) to output the defines table in to a file on disk?
Code: Select all
-- something like...
-- make a copy that serpent can use
local definesCopy = table.deepcopy(defines)
-- use serpent to turn it in to string
local definesStr = serpent.block( definesCopy )
-- put it in a file
script.write_file('defines.lua', definesStr)
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
- DedlySpyder
- Filter Inserter
- Posts: 253
- Joined: Fri Jun 20, 2014 11:42 am
- Contact:
Re: defines.lua - where is it?
I'm pretty sure that the Lua documentation is also included in the game files, so you wouldn't have to go put to the site to parse the info
Re: defines.lua - where is it?
Yes the docs are delivered with the binary.
Thanks for the help. I think the serialization idea is the most useful.
Thanks for the help. I think the serialization idea is the most useful.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: defines.lua - where is it?
Thanks for the serialization tip! I Am surprised I didn't think of it but I will use the heck out of it at least until I figure out how to parse it into an autocompletion filessilk wrote:Yes the docs are delivered with the binary.
Thanks for the help. I think the serialization idea is the most useful.
Re: defines.lua - where is it?
You're welcome: https://raw.githubusercontent.com/Affor ... efines.luassilk wrote:Lately I was experimenting again with writing mods. With 0.13 it seems, that defines.lua is removed from data/core, but seems to be "silently" required - I think some internal stuff, nice.
My problem with this: I found the defines.lue super-practical, cause my IDE was able to interpret it in a way, that it showed me the definitions.
(For interested: I use PHPStorm on MacOS and just needed to set an include-path to /Applications/factorio.app/Contents/data )
Cause I'm a friend of automatic code verification I would like to use this again.
Does anybody have a good idea to do that?
How to create your own: serialize the data to a file, game.write_file("defines.lua", serpent.block(_G.defines, {comments=false}))