Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8168603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:34:53+00:00 2026-06-06T20:34:53+00:00

I am using director class for scene transitions and i need to use the

  • 0

I am using director class for scene transitions and i need to use the variable in a class in another class. So how can i call it?

     local a= require "welcome"

variableName is text display object in welcome class

     print(a.variableName.text)

However i get nil.

Could you help me out? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:34:55+00:00Added an answer on June 6, 2026 at 8:34 pm

    Make the variable a property of the returned table:

    local Class = {}
    
    function Class.new()
        local class = {}
    
        class.variableName = display.newText("Hello mom!", 100, 100, "Helvetica", 18)
    
        return class
    end
    
    return Class
    

    Then you can reference it:

    local a = require ("class").new()
    
    print(a.variableName.text)
    

    OR

    If you want to pass variables between the screens in Rauber’s Director Class, you can:

    local parameters = {p1="some text", p2="some more text"}
    
    director:changeScene(parameters, "sceneName")
    

    In your screen, make the new function accept the parameters:

    function new(parameters)
        print(parameters.p1, parameters.p2) --> some text   some more text
    end
    

    OR

    Put _G in front of your variable

    _G.myGlobalVar = "some awesome stuff"
    

    Then you can reference it in another class

    print(_G.myGlobalVar) --> some awesome stuff
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to authenticate via Active Directory Services using the PrincipalContext class. I
Problem Using Director 11.5 and Windows 7, with MouseWheel Xtra (wheelmouse.zip), I have the
I'm using the zend modular director structure, i.e. application modules users controllers . .
I am wondering whether watching a file/directory for changes using the FileSystemWatcher class is
I have two programs which are accessing a directory using the .NET Directory class
I'm creating and updating Groups in Active Directory using the GroupPrincipal class in System.DirectoryServices.AccountManagement
I'm trying to lookup a user on a local active-directory using java. When I
I am trying to use IronPython with monodroid (using a Android 4 phone) so
I'm trying to iterate over the class files in a known directory using streams.
I'm trying to use a authenticate with an Active directory using Spring Security 3.1.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.