Skip to content

possibly incorrect variable scoping #22

@Nitish-bot

Description

@Nitish-bot

I was exploring L5 trying to write a mandelbrot set and I declare height and width variables when I found out there are global variables part of L5's internal state. The code can be found here

  -- global user vars - can be read by user but shouldn't be altered by user
  key = "" --default, overriden with key presses detected in love.update(dt)
  width = 800 --default, overridden with size() or fullscreen()
  height = 600 --ditto
  frameCount = 0
  mouseIsPressed = false
  mouseX=0
  mouseY=0
  keyIsPressed = false
  pmouseX,pmouseY,movedX,movedY=0,0
  mouseButton = nil
  focused = true
  pixels = {}

I feel like what we don't want the user manipulating , we shouldn't give them the ability to (not as easily at least). I might be missing something here but I think we can add them to L5_env table so if someone really wants to change these values they can but only if they know what they're doing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions