Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Referencing info from other Lua Files
Started by hi1 Mar 16 2016 01:57 PM

- - - - -
1 reply to this topic

Best Answer Rob Miracle , 16 March 2016 - 03:50 PM

Yes. People do this all the time. They are called "Modules". See: https://coronalabs.com/blog/2012/08/28/how-external-modules-work-in-corona/

 

Rob

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

hi1

[GLOBAL: userInfoPane.html]
hi1
  • Enthusiast

  • 49 posts
  • Corona SDK

Hi all-

 

 

I had a quick question regarding referencing functions/objects from other Lua files.

 

Right now I have my main.lua, which contains my games home screen components (basic button info, UI layout, etc.)  I am using multiple Lua files for each individual level, however I want to reduce repeating the code on each screen for buttons.

 

With that being said, would it be possible to make a buttons.lua file, and keep all my button code in there (like size, color, etc.)?

 

Thanks!



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,539 posts
  • Enterprise

  Best Answer

Yes. People do this all the time. They are called "Modules". See: https://coronalabs.com/blog/2012/08/28/how-external-modules-work-in-corona/

 

Rob




[topic_controls]
[/topic_controls]