unprecise error
unprecise error
It is not a real bug, but more a strange thing.
When trying to insert an invalid ItemStack into an inventory, I got this : By chance, I manage to find out where I made a mistake, but why is this error message so unprecise ?
The event is not named, and no error line...
When trying to insert an invalid ItemStack into an inventory, I got this : By chance, I manage to find out where I made a mistake, but why is this error message so unprecise ?
The event is not named, and no error line...
My mods on the Factorio Mod Portal 

Re: unprecise error
Hmm, it does seem very unhelpful
Re: unprecise error
Do you speak about the message, or do you mean that you want more precisions on how I trigger this ?Klonan wrote:Hmm, it does seem very unhelpful
In case, I called this erronous function from on_player_selected_area event :
Code: Select all
--------------------------------------------------------------------------------------
function retrieve_in_bag(inv_player,inv)
for n=1,#inv do
inv_player.insert(inv[n]) -- FORGOT TO TEST VALID_FOR_READ HERE, SO ERROR
end
return(not inv.is_empty())
end
My mods on the Factorio Mod Portal 

Re: unprecise error
Are you able to reproduce that error? When I get the error it gives the mod name and line in the file that the error was produced from.
Please upload a test save and mod that I can reproduce the error not containing that information.
Please upload a test save and mod that I can reproduce the error not containing that information.
If you want to get ahold of me I'm almost always on Discord.
Re: unprecise error
Yes I can reproduce.
Please upload test map, mod (including error), + log.
Load map, use my Copy tool and just select the group of objects right up to you. Choose "wipe all settings" -> unprecised bug
The original error is in control.lua , line 157. Now it's corrected, but to trigger the bug, I commented 2 lines to get the error.
Please upload test map, mod (including error), + log.
Load map, use my Copy tool and just select the group of objects right up to you. Choose "wipe all settings" -> unprecised bug
The original error is in control.lua , line 157. Now it's corrected, but to trigger the bug, I commented 2 lines to get the error.
Code: Select all
0.001 2016-07-31 22:53:14; Factorio 0.13.13 (build 23721, win64, alpha)
0.001 Operating system: Windows 7 Service Pack 1
0.001 Program arguments: "c:\Factorio0\bin\x64\factorio0.exe" "--load-game" "C:\Factorio0\saves\testCopySettings05.zip"
0.001 Read data path: c:/Factorio0/data
0.001 Write data path: c:/Factorio0
0.001 Binaries path: c:/Factorio0/bin
0.013 Graphics options: [FullScreen: false] [VSync: false] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: high] [Light scale: 100%] [Screen: 255] [DXT: false]
0.014 Available display adapters: 1
0.014 [0]: \\.\DISPLAY1 - NVIDIA GeForce GTX 750 Ti {0x05, [0,0], 1920x1080, 32bit, 60Hz}
0.014 Create display on adapter 0. Size 1280x720 at position [310, 162].
0.053 Initialised Direct3D:[0] NVIDIA GeForce GTX 750 Ti; driver: nvd3dumx.dll 10.18.13.6839
0.055 Video memory size (dedicated video/dedicated system/shared system/available): 1992/0/2048/4037 MB
0.097 Desktop composition is active.
0.154 Loading mod core 0.0.0 (data.lua)
0.158 Loading mod base 0.13.13 (data.lua)
0.238 Loading mod CopySettingsTool 1.0.2 (data.lua)
0.286 Loading mod CopySettingsTool 1.0.2 (data-final-fixes.lua)
0.333 Checksum for core: 3471280900
0.333 Checksum for mod base: 439759882
0.333 Checksum for mod CopySettingsTool: 767434273
0.673 Initial atlas bitmap size is 16384
0.675 Created atlas bitmap 16384x6372
1.005 Created atlas bitmap 4096x968
6.988 Sprites loaded
6.988 Convert atlas 4096x968 to: trilinear-filtering
7.217 Loading sounds...
8.495 Custom inputs active: 1
8.529 Factorio initialised
8.530 Loading map C:\Factorio0\saves\testCopySettings05.zip
8.562 Info Scenario.cpp:127: Map version 0.13.13-0
8.894 Checksum for script c:/Factorio0/temp/currently-playing/control.lua: 900459546
8.896 Checksum for script __CopySettingsTool__/control.lua: 2320533580
21.328 Loading map c:/Factorio0\saves\testCopySettings06.zip
21.358 Info Scenario.cpp:127: Map version 0.13.13-0
21.690 Checksum for script c:/Factorio0/temp/currently-playing/control.lua: 900459546
21.691 Checksum for script __CopySettingsTool__/control.lua: 2320533580
27.197 Error MainLoop.cpp:665: Exception at tick 349275: Error while running the event handler: LuaItemStack API call when LuaItemStack was invalid.
31.990 Goodbye
My mods on the Factorio Mod Portal 

Re: unprecise error
Interesting.. I found the issue but it's an issue with the internals of Lua.
I've changed the way error messages are shown for Lua errors for 0.13.14:
http://imgur.com/a/GU5Gl
So, this should be resolved for 0.13.14.
I've changed the way error messages are shown for Lua errors for 0.13.14:
http://imgur.com/a/GU5Gl
So, this should be resolved for 0.13.14.
If you want to get ahold of me I'm almost always on Discord.
Re: unprecise error
Great, because it's not the first time I have this problem, but I never take the time to report it.
My mods on the Factorio Mod Portal 

Re: unprecise error
This is good cause I somehow manage to make mistakes that give me cryptic errors too then I have to hunt down my typo!
Re: unprecise error
Don't speak about typos ! It makes me nervous.Nexela wrote:This is good cause I somehow manage to make mistakes that give me cryptic errors too then I have to hunt down my typo!

This non declarative lua langage is strange.
Last day, I spend hours finding out a bug : I was making a comparison with a whatever-tim7 value that should have been written whatever-time7 !!!
And that's not the first time it happens...
Is there no way to force this langage declarative ? Any option at the beginning of the code ? For the rest I find LUA very convenient.
My mods on the Factorio Mod Portal 

Re: unprecise error
you can use LuaCheck It is a pain to get set up on windows though.
viewtopic.php?f=34&t=29919 has a little guide if your using sublimetext. But still a pain on windows.
I got it working somewhat on windows with Geany and it is awesome.
luacheck TimeTools --globals global game script colors > luacheck.txt
viewtopic.php?f=34&t=29919 has a little guide if your using sublimetext. But still a pain on windows.
I got it working somewhat on windows with Geany and it is awesome.
luacheck TimeTools --globals global game script colors > luacheck.txt
Code: Select all
Checking TimeTools_1.0.21\config.lua 3 warnings
TimeTools_1.0.21\config.lua:1:1: setting non-standard global variable 'maximum_speed'
TimeTools_1.0.21\config.lua:2:1: setting non-standard global variable 'clock_cycle_in_ticks'
TimeTools_1.0.21\config.lua:3:1: setting non-standard global variable 'clock_combinator_cycle'
Checking TimeTools_1.0.21\control.lua 71 warnings
TimeTools_1.0.21\control.lua:2:1: setting non-standard global variable 'debug_mod_name'
TimeTools_1.0.21\control.lua:3:1: setting non-standard global variable 'debug_file'
TimeTools_1.0.21\control.lua:3:14: accessing undefined variable 'debug_mod_name'
TimeTools_1.0.21\control.lua:17:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:26:41: accessing undefined variable 'maximum_speed'
TimeTools_1.0.21\control.lua:36:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:39:3: accessing undefined variable 'build_gui'
TimeTools_1.0.21\control.lua:53:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:64:36: accessing undefined variable 'debug_mod_name'
TimeTools_1.0.21\control.lua:66:4: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:66:33: accessing undefined variable 'debug_mod_name'
TimeTools_1.0.21\control.lua:81:38: accessing undefined variable 'older_version'
TimeTools_1.0.21\control.lua:87:38: accessing undefined variable 'older_version'
TimeTools_1.0.21\control.lua:93:4: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:104:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:109:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:115:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:120:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:127:3: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:135:3: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:139:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:140:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:147:3: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:156:3: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:160:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:161:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:162:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:165:24: unused argument 'event'
TimeTools_1.0.21\control.lua:167:18: accessing undefined variable 'clock_cycle_in_ticks'
TimeTools_1.0.21\control.lua:171:3: setting non-standard global variable 'tim'
TimeTools_1.0.21\control.lua:172:3: setting non-standard global variable 'tim'
TimeTools_1.0.21\control.lua:172:10: accessing undefined variable 'tim'
TimeTools_1.0.21\control.lua:173:3: setting non-standard global variable 'tim_h'
TimeTools_1.0.21\control.lua:173:22: accessing undefined variable 'tim'
TimeTools_1.0.21\control.lua:174:3: setting non-standard global variable 'tim_m'
TimeTools_1.0.21\control.lua:174:23: accessing undefined variable 'tim'
TimeTools_1.0.21\control.lua:174:27: accessing undefined variable 'tim_h'
TimeTools_1.0.21\control.lua:179:7: accessing undefined variable 'tim_h'
TimeTools_1.0.21\control.lua:187:61: accessing undefined variable 'tim_h'
TimeTools_1.0.21\control.lua:187:68: accessing undefined variable 'tim_m'
TimeTools_1.0.21\control.lua:203:9: accessing undefined variable 'debug_status'
TimeTools_1.0.21\control.lua:211:19: accessing undefined variable 'tim_h'
TimeTools_1.0.21\control.lua:214:20: accessing undefined variable 'clock_combinator_cycle'
TimeTools_1.0.21\control.lua:218:6: setting non-standard global variable 'params'
TimeTools_1.0.21\control.lua:221:71: accessing undefined variable 'tim_h'
TimeTools_1.0.21\control.lua:222:73: accessing undefined variable 'tim_m'
TimeTools_1.0.21\control.lua:223:76: accessing undefined variable 'iif'
TimeTools_1.0.21\control.lua:228:55: accessing undefined variable 'params'
TimeTools_1.0.21\control.lua:241:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:253:3: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:261:3: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:266:3: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:269:19: accessing undefined variable 'maximum_speed'
TimeTools_1.0.21\control.lua:271:3: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:275:3: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:280:17: accessing undefined variable 'defines'
TimeTools_1.0.21\control.lua:283:10: setting non-standard global variable 'build_gui'
TimeTools_1.0.21\control.lua:287:3: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:294:6: accessing undefined variable 'debug_status'
TimeTools_1.0.21\control.lua:302:10: setting non-standard global variable 'update_guis'
TimeTools_1.0.21\control.lua:307:18: accessing undefined variable 'build_gui'
TimeTools_1.0.21\control.lua:344:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:364:2: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:368:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:383:2: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:387:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:391:2: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:395:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:405:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\control.lua:409:2: accessing undefined variable 'update_guis'
TimeTools_1.0.21\control.lua:413:1: accessing undefined variable 'remote'
Checking TimeTools_1.0.21\data.lua OK
Checking TimeTools_1.0.21\prototypes\entities.lua 1 warning
TimeTools_1.0.21\prototypes\entities.lua:1:1: accessing undefined variable 'data'
Checking TimeTools_1.0.21\prototypes\items.lua 1 warning
TimeTools_1.0.21\prototypes\items.lua:1:1: accessing undefined variable 'data'
Checking TimeTools_1.0.21\prototypes\recipies.lua 2 warnings
TimeTools_1.0.21\prototypes\recipies.lua:1:1: accessing undefined variable 'data'
TimeTools_1.0.21\prototypes\recipies.lua:19:15: accessing undefined variable 'data'
Checking TimeTools_1.0.21\prototypes\signals.lua 1 warning
TimeTools_1.0.21\prototypes\signals.lua:1:1: accessing undefined variable 'data'
Checking TimeTools_1.0.21\prototypes\styles.lua 2 warnings
TimeTools_1.0.21\prototypes\styles.lua:1:1: accessing undefined variable 'data'
TimeTools_1.0.21\prototypes\styles.lua:35:21: accessing undefined variable 'data'
Checking TimeTools_1.0.21\utils.lua 38 warnings
TimeTools_1.0.21\utils.lua:30:1: setting non-standard global variable 'anticolors'
TimeTools_1.0.21\utils.lua:54:1: setting non-standard global variable 'lightcolors'
TimeTools_1.0.21\utils.lua:70:10: setting non-standard global variable 'read_version'
TimeTools_1.0.21\utils.lua:72:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\utils.lua:76:10: setting non-standard global variable 'compare_versions'
TimeTools_1.0.21\utils.lua:105:10: setting non-standard global variable 'older_version'
TimeTools_1.0.21\utils.lua:131:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\utils.lua:137:10: setting non-standard global variable 'debug_active'
TimeTools_1.0.21\utils.lua:141:6: unused loop variable 'i'
TimeTools_1.0.21\utils.lua:145:19: accessing undefined variable 'debug_do_raz'
TimeTools_1.0.21\utils.lua:146:20: accessing undefined variable 'debug_file'
TimeTools_1.0.21\utils.lua:147:3: setting non-standard global variable 'debug_do_raz'
TimeTools_1.0.21\utils.lua:154:6: accessing undefined variable 'debug_mod_name'
TimeTools_1.0.21\utils.lua:155:19: accessing undefined variable 'debug_file'
TimeTools_1.0.21\utils.lua:162:4: accessing undefined variable 'debug_status'
TimeTools_1.0.21\utils.lua:162:27: setting non-standard global variable 'debug_print'
TimeTools_1.0.21\utils.lua:162:41: accessing undefined variable 'debug_active'
TimeTools_1.0.21\utils.lua:162:59: setting non-standard global variable 'debug_print'
TimeTools_1.0.21\utils.lua:165:10: setting non-standard global variable 'message_all'
TimeTools_1.0.21\utils.lua:174:10: setting non-standard global variable 'square_area'
TimeTools_1.0.21\utils.lua:182:10: setting non-standard global variable 'distance'
TimeTools_1.0.21\utils.lua:189:10: setting non-standard global variable 'distance_square'
TimeTools_1.0.21\utils.lua:194:10: setting non-standard global variable 'pos_offset'
TimeTools_1.0.21\utils.lua:199:10: setting non-standard global variable 'surface_area'
TimeTools_1.0.21\utils.lua:219:10: setting non-standard global variable 'iif'
TimeTools_1.0.21\utils.lua:228:10: setting non-standard global variable 'add_list'
TimeTools_1.0.21\utils.lua:230:6: unused loop variable 'i'
TimeTools_1.0.21\utils.lua:240:10: setting non-standard global variable 'del_list'
TimeTools_1.0.21\utils.lua:251:10: setting non-standard global variable 'in_list'
TimeTools_1.0.21\utils.lua:261:10: setting non-standard global variable 'is_dev'
TimeTools_1.0.21\utils.lua:266:10: setting non-standard global variable 'dupli_proto'
TimeTools_1.0.21\utils.lua:267:5: accessing undefined variable 'data'
TimeTools_1.0.21\utils.lua:268:32: accessing undefined variable 'data'
TimeTools_1.0.21\utils.lua:283:10: setting non-standard global variable 'debug_guis'
TimeTools_1.0.21\utils.lua:285:2: accessing undefined variable 'debug_print'
TimeTools_1.0.21\utils.lua:287:6: unused loop variable 'k'
TimeTools_1.0.21\utils.lua:288:3: accessing undefined variable 'debug_guis'
TimeTools_1.0.21\utils.lua:293:10: setting non-standard global variable 'extract_monolith'
Total: 119 warnings / 0 errors in 9 files
Re: unprecise error
Very interesting, but it seems that it does not check "includes" because most of the variables detected as undefined are in my utils.lua module.
And it also reports functions that are declared in the current control.lua module. Strange.
So it's a tool that you run independantly. It's a solution when I have a mysterious bug.
But if it does not exist under windows, I'm damned !
And it also reports functions that are declared in the current control.lua module. Strange.
So it's a tool that you run independantly. It's a solution when I have a mysterious bug.
But if it does not exist under windows, I'm damned !

My mods on the Factorio Mod Portal 

Re: unprecise error
Those warnings are because the variables and functions have global scope verses local scope. They can be suppressed or added to the globals list. Or just set up everything to be local