Author Topic: [invalid] getUnitsForFaction() optional values aren't actually optional  (Read 519 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
OS: Ubuntu 12.04

As found by Wciow in the IRC earlier, getUnitsForFaction(int index, string command, int field) isn't treating the field (an integer where 0 = land and 1 = air) as optional (or at least it's not when a command has been entered). This also means there's no way to get all the units in the faction (besides two function calls), as you have to specify a field.
« Last Edit: 1 May 2013, 10:28:45 by tomreyn »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
I believe there are no lua functions that have optional parameters, all parameters must be specified.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Oh, my bad. I didn't realize Lua doesn't support function overloading or default values. I updated the wiki to reflect the non-optional status.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Since the behaviour described here is as designed, I'll tag this as [invalid]. Please update the title and add a new post to the thread if / when the issue described here occurs again.

Also thank you for updating the documentation on this one, Omega.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

 

anything