-- main.lua
local storyboard = require "storyboard";
display.setStatusBar ( display.HiddenStatusBar )
--Setting up Global variables
\_W = display.contentWidth;
\_H = display.contentHeight;
-- Load first scene mainmenu.lua
local options=
{
effect = "fade",
time = 10000
}
storyboard.gotoScene( "mainmenu", options )
-- mainmenu.lua
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
function scene:createScene( event )
local menuGroup = self.view
mainBg = display.newImageRect("images/menubg.png", 820, 960);
mainBg.x = \_W/2;
mainBg.y = \_H/2;
the last 2 lines of mainmenu.lua show the warning “Possibly Uninitialized” (warning sign in yellow color triangle next to code numbering) [import]uid: 31508 topic_id: 32207 reply_id: 128229[/import]
Your code looks fine to me. I had at first thought the warning you referred to was an output to the terminal when you ran your code, but now I realize that you’re using some sort of code editor or IDE, like Glider, and it’s in the editor that you’re seeing the warning, right? In that case, it’s an issue with the editor not realizing that the variable was initialized. If the warning bothers you, I imagine there’s some way to address it or suppress it, but I’m not familiar with any of the common editors, so I wouldn’t be able to tell you exactly how.
Andrew [import]uid: 109711 topic_id: 32207 reply_id: 128233[/import]
@bpran,
We are in the process of rewriting the parser so that it handles multiple files/projects better. This is the exact kind of false warning we are working on eliminating. We will be sure to check this code snippet during testing.
You can suppress warnings via options->Glider->Editor->Warnings
-- main.lua
local storyboard = require "storyboard";
display.setStatusBar ( display.HiddenStatusBar )
--Setting up Global variables
\_W = display.contentWidth;
\_H = display.contentHeight;
-- Load first scene mainmenu.lua
local options=
{
effect = "fade",
time = 10000
}
storyboard.gotoScene( "mainmenu", options )
-- mainmenu.lua
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
function scene:createScene( event )
local menuGroup = self.view
mainBg = display.newImageRect("images/menubg.png", 820, 960);
mainBg.x = \_W/2;
mainBg.y = \_H/2;
the last 2 lines of mainmenu.lua show the warning “Possibly Uninitialized” (warning sign in yellow color triangle next to code numbering) [import]uid: 31508 topic_id: 32207 reply_id: 128229[/import]
Your code looks fine to me. I had at first thought the warning you referred to was an output to the terminal when you ran your code, but now I realize that you’re using some sort of code editor or IDE, like Glider, and it’s in the editor that you’re seeing the warning, right? In that case, it’s an issue with the editor not realizing that the variable was initialized. If the warning bothers you, I imagine there’s some way to address it or suppress it, but I’m not familiar with any of the common editors, so I wouldn’t be able to tell you exactly how.
Andrew [import]uid: 109711 topic_id: 32207 reply_id: 128233[/import]
@bpran,
We are in the process of rewriting the parser so that it handles multiple files/projects better. This is the exact kind of false warning we are working on eliminating. We will be sure to check this code snippet during testing.
You can suppress warnings via options->Glider->Editor->Warnings