I made a function “wall” that pretty much creates a new rectangle. I created a variable called leftw that calls the function and aligns the wall to the left, and that worked, however when I create a second variable that calls the same function I get a error message… This error message: Attempt to call global wall (a table value) stack traceback: 23 in main chunk.
Am I not allowed to use a function with different variables?
Please help
Here is my code.
--starting physics local physics = require( "physics" ) physics.start( ) display.setStatusBar( display.HiddenStatusBar ) --screen variables local screenW = display.contentWidth local screenH = display.contentHeight local screenCY = display.contentCenterY local screenCX = display.contentCenterX --create walls and floors function wall(x, y , w, h) wall = display.newRect( x, y, w, h ) wall:setFillColor( 10, 10, 10 ) wall.anchorX=0 wall.anchorY=0 return wall end local leftw = wall(0, 0, 70,100) local rightw = wall( 0, 0, 200, 100)