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: Question about local booleans

Previous Thread :: Next Thread 
raystriker6707 is online. raystriker6707
Joined: 02 Dec 2011
Total Posts: 96
13 Mar 2017 09:38 PM
So, recently in a lot of scripts for my game, I have been needing to use local Booleans. They usually take the form of something like this.

local d = true
local d1 = true
local d2 = true
local d3 = true
etc.

I was wondering if there was a way to make local Booleans d1-100 or something without having to list them out like I am. A more efficient way to make booleans. It's hard to explain kinda but I need a more efficient way to make 1-100 numbered Booleans without listing them like I am.
Thanks. :)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Mar 2017 09:39 PM
Have a table of booleans, so like:
local d = { true, true, true, true, ... }

and to check if a certain one is true:
if d[3] then
...
Report Abuse
AbstractCode is not online. AbstractCode
Joined: 26 Aug 2016
Total Posts: 654
13 Mar 2017 09:43 PM
local d,d1,d2 = true,true,true

local boolTable = {}

for i = 1, 100, 1 do
boolTable[i] = true
end
Report Abuse
raystriker6707 is online. raystriker6707
Joined: 02 Dec 2011
Total Posts: 96
14 Mar 2017 03:15 PM
Thanks guys this helped a lot :D
Report Abuse
Atavis is not online. Atavis
Joined: 10 Apr 2012
Total Posts: 1463
14 Mar 2017 03:28 PM
loops > the meaning and result of our lives


747,365 slices of pizza and counting!
Report Abuse
AlreadyPro is not online. AlreadyPro
Joined: 24 Feb 2012
Total Posts: 2463
14 Mar 2017 04:29 PM
or...

for i = 1,100 do
getfenv()["d"..i] = true
end


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
14 Mar 2017 04:42 PM
"local" booleans


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Mar 2017 05:03 PM
To be fair the term "local boolean" doesn't even make sense but that's regard the point. By using `getfenv` you miss the entire point of what the OP wants and made a less efficient, more disgusting script. Even if you used debug.setlocal (which ofc. was removed by Roblox) you would have been more relevant.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
14 Mar 2017 05:04 PM
OP probably meant booleans that are only accessible to the scope of the current function.


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
14 Mar 2017 05:04 PM
from*


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Mar 2017 05:05 PM
yee
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