Modding Help Lua error code 3

Discussion in 'Starbound Modding' started by Quintexial, Oct 8, 2017.

  1. Quintexial

    Quintexial Subatomic Cosmonaut

    function update(dt)
    mcontroller.controlModifiers({airJumpModifier = 1.5});
    if mcontroller.facingDirection() == 1 then
    mcontroller.controlParameters(self.movementParameters.standingPoly, {[-5, -2.0], [-4.60, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, 0.65], [0.35, 1.22], [-4.60, 1.22], [-5, 0.65]} );
    mcontroller.controlParameters(self.movementParamaters.crouchingPoly, {[-2, -2.0], [-1.60, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, -1], [0.35, -0.5], [-1.60, -0.5], [-2, -1]} );​
    end
    end

    I get Error code 3 - ']' expected near ','
    Exactly what am I doing wrong?
     
  2. TheElderScroller

    TheElderScroller Pangalactic Porcupine

    In lua you don't use [ and ] for objects and arrays (tables), you use { and }.
    Code:
    function update(dt)
      mcontroller.controlModifiers({airJumpModifier = 1.5})
      if mcontroller.facingDirection() == 1 then
        mcontroller.controlParameters(self.movementParameters.standingPoly, {{-5, -2.0}, {-4.60, -2.5}, {0.35, -2.5}, {0.75, -2.0}, {0.75, 0.65}, {0.35, 1.22}, {-4.60, 1.22}, {-5, 0.65}})
        mcontroller.controlParameters(self.movementParamaters.crouchingPoly, {{-2, -2.0}, {-1.60, -2.5}, {0.35, -2.5}, {0.75, -2.0}, {0.75, -1}, {0.35, -0.5}, {-1.60, -0.5}, {-2, -1}})
      end
    end
    
    Also, you don't need the ; to end a line, but you can use it though...
     

Share This Page