generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How inefficient is having a couple hundred string values?

Previous Thread :: Next Thread 
Matsushima is not online. Matsushima
Joined: 11 Jan 2015
Total Posts: 614
04 Jul 2016 04:38 PM
I would rather not have a bunch of tables in scripts, and instead keep a poop ton of string values in Lighting to contain info.

How inefficient is this?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
04 Jul 2016 04:43 PM
Not as efficient as having a couple dozen string values, but more efficient than having a couple thousand string value.

Of course, tables are cleaner and prettier. You should probably just go with those. Use a new script or ModuleScript if you want to keep it clean. Use _G.


Report Abuse
SerGregor is not online. SerGregor
Joined: 17 Jul 2010
Total Posts: 7957
04 Jul 2016 05:01 PM
^ I heard _G was bad practice when I once asked someone here for methods and I suggested if I should use _G..
Report Abuse
BeautifuIThunder is not online. BeautifuIThunder
Joined: 22 Jan 2011
Total Posts: 153
04 Jul 2016 05:07 PM
I guess you could have one long string and find a way to extract from the string appropriate to your system. Or just a few long strings


218,995 slices of pizza and counting
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
04 Jul 2016 05:07 PM
If you're going to do that, at least store them in the ServerStorage if you're trying to access them in a script (not local).


-=[ RAP: 345,446 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
04 Jul 2016 05:10 PM
_G is fine, it just puts it in a higher scope.


"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin
Report Abuse
mudkip99 is not online. mudkip99
Joined: 17 Jun 2008
Total Posts: 3362
04 Jul 2016 05:11 PM
You can store them in a modulescript.
Report Abuse
mudkip99 is not online. mudkip99
Joined: 17 Jun 2008
Total Posts: 3362
04 Jul 2016 05:11 PM
(a table in a modulescript)
Report Abuse
SerGregor is not online. SerGregor
Joined: 17 Jul 2010
Total Posts: 7957
04 Jul 2016 05:11 PM
^ People always told me it's bad to use _G and use module scripts..wow.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
04 Jul 2016 05:13 PM
If ModuleScripts were bad, why would Roblox even bother making them in the first place? They actually made quite a deal out of them.


"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
04 Jul 2016 05:13 PM
@Ser
Whoever told you its bad to use module scripts is seriously an inefficient coder. Modules are pretty nifty to use.


-=[ RAP: 345,451 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
mudkip99 is not online. mudkip99
Joined: 17 Jun 2008
Total Posts: 3362
04 Jul 2016 05:23 PM
Globals are generally bad practice, modules are the exact opposite. Using modules allows code reuse, which is very good for code maintainence.
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
04 Jul 2016 05:27 PM
There is absolutely nothing wrong with using the _G library and module scripts.

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
BeautifuIThunder is not online. BeautifuIThunder
Joined: 22 Jan 2011
Total Posts: 153
04 Jul 2016 05:28 PM
It's just bad practice to use global variables in any coding language as it's much easier to get confused on which identifier is where and doing what.


218,868 slices of pizza and counting
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
04 Jul 2016 05:30 PM
I do agree that there are better alternatives to the global library, but it's not like storage objects in Lighting or using deprecated functions.

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
04 Jul 2016 05:30 PM
There is absolutely nothing wrong with using the _G library and module scripts. [2]
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
04 Jul 2016 05:31 PM
storing*

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
04 Jul 2016 05:35 PM
I do think though that _G functions are much easier to use than raw coroutines.
Report Abuse
Cinnace is not online. Cinnace
Joined: 21 Jun 2016
Total Posts: 370
04 Jul 2016 05:38 PM
I would off myself without modulescripts. it would make for terrible unorganized code.


- Cinnace
Report Abuse
SerGregor is not online. SerGregor
Joined: 17 Jul 2010
Total Posts: 7957
04 Jul 2016 06:21 PM
No, module scripts are good. People said I should stop with _G and just do module scripts. I mean, I don't see why the global table is bad though.
Report Abuse
BeautifuIThunder is not online. BeautifuIThunder
Joined: 22 Jan 2011
Total Posts: 153
05 Jul 2016 05:02 AM
Nothing explicitly wrong with them as far as I can see... Which isn't very far tbh x'D


218,626 slices of pizza and counting
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
05 Jul 2016 06:44 AM
_G is thoroughly disgusting. If you need to access something across multiple scripts, use ModuleScripts.


Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 06:47 AM
Yeah using a ModuleScript seems like the best solution for this.
And yes, _G is bad practice because it teaches you how to write crap code. There are very few times where you would need to use _G. No, it's not inefficient, it's just bad practice. It makes no sense that your "hundreds of strings" can be accessed anywhere.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
05 Jul 2016 07:08 AM
_G can however be used for singletons. This is the issue that people are forgetting, because _G is perfect for singletons and utility details where it is guaranteed to exist by the time the script is run.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
05 Jul 2016 01:48 PM
WaitForChild was created for a reason. It even has a handy timeout warning now if you try to wait for something that's never going to exist.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image