Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

[Logged] SideWrapper unitsBy intereting case of exception.

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> [Logged] SideWrapper unitsBy intereting case of exception. Page: [1]
Login
Message << Older Topic   Newer Topic >>
[Logged] SideWrapper unitsBy intereting case of exception. - 6/13/2021 3:42:19 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
So I came across this interesting thing.

1. Restart CMO.
2. Load the attached scene in the editor.
3. Press the special action with "FreshStart" in the name.
4. Note the invalid parameters to method exception. for feeding nil as a category in the filter.
5. Press the second special action with "NonNil" in the name.
6. Note it runs.
7. Press the special action with "FreshStart" in the name.
8. Note it now runs fine with no exception.

[optional]
9. reload map and repeat for same results still works.
10. exit to main menu and reenter editor and repeat (same result still works.)
11. Restart CMO a second time.
12. repeat the step BUT this time run "NonNil" first, and then "FreshStart". - NO exceptions.

[optional]
If you run same test excluding the additional params (so defaults get used) in an attempt to test 'initializing' it. ie s:unitsBy("Facility"); that will not clear the way for #3 above to run.

Weird huh. It's more curious to me why nil works after than why nil fails initially.
Even more weird cause I can see the function has a default in it's definition of 0 so I'm not sure what exactly is going on other than something buried deep in translation layer before it even gets there.

exception:
quote:


-- B1147.25 -- Invalid arguments to method: LuaWrapper_Side.unitsBy
Exception: Invalid arguments to method: LuaWrapper_Side.unitsBy
Stack Trace: at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
at NLua.Lua.DoString(String chunk, String chunkName)
at Command_Core.Lua.LuaSandBox.RunScript(String str, Boolean RunInteractively, String script)
at Command_Core.SpecialAction.(Scenario )
Call Stack & Error details:
Error at 101325,

...and no I'm not trying to find these things, just come across them, this one was from a "why is something that worked for a an entire day flawlessly suddenly not working on restart" incident. :)


Attachment (1)

< Message edited by WSBot -- 6/14/2021 2:48:43 PM >
Post #: 1
RE: SideWrapper unitsBy intereting case of exception. - 6/14/2021 1:39:24 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
The parameters of 'unitsBy' are defined as integers, the default being 0 if none supplied.
This is Nlua complaining about a 'nil' when it should be a 'integer' - doesn't even get into the function.

Can't see why Nlua suddenly 'likes nil' - I can see it has changed it to 0 when it passes it to the 'unitsBy' function in step #7.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 2
RE: SideWrapper unitsBy intereting case of exception. - 6/14/2021 1:45:19 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
I can fix the inconsistency by making those 2 parameters 'interger?' which means that a nil will be accepted but the parameters are supposed to be integers.
Tested okay when I tried it - the 'nil' was passed to the function so issue seems to be in how Nlua package is handling it.

_____________________________

Michael

(in reply to michaelm75au)
Post #: 3
RE: SideWrapper unitsBy intereting case of exception. - 6/14/2021 2:48:50 PM   
WSBot

 

Posts: 182
Joined: 1/17/2021
Status: offline
0014604

(in reply to michaelm75au)
Post #: 4
RE: SideWrapper unitsBy intereting case of exception. - 6/15/2021 2:16:58 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline

quote:

ORIGINAL: michaelm75au

I can fix the inconsistency by making those 2 parameters 'interger?' which means that a nil will be accepted but the parameters are supposed to be integers.
Tested okay when I tried it - the 'nil' was passed to the function so issue seems to be in how Nlua package is handling it.

Interesting, that NLua after a successful first use of the second param would "learned and cache" that it's allowed nils but I guess it does some how, or maybe it works due to luck\nature of how things are done in NLua. Anyway.. cool that you could find solution that works around it, while also still allowing nil (as that will save some coding on the script side).


(in reply to michaelm75au)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> [Logged] SideWrapper unitsBy intereting case of exception. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.609