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
 

Heyyy heeyyyy heyyyy guys!

Previous Thread :: Next Thread 
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
21 Sep 2015 06:18 PM
I'm looking for simple little functions that I could use, like rounding, and easy color3, yeah stuff like that.


So far I have this, please add to it!

local module = {
["color"] = function(r,b,g)
return Color3.new(r/255,b/255,g/255)
end,
["round"] = function(num,a)
return math.floor(num/a+.5)*a
end
}
return module
Report Abuse
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
21 Sep 2015 06:38 PM
Thanks for all your input!
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
21 Sep 2015 06:43 PM
Heres 1 :SIKE!!!!!!!!!!! Wrong Fourm, Go to script helper or LMAD.
Report Abuse
AdministratorRights is not online. AdministratorRights
Joined: 19 Sep 2015
Total Posts: 85
21 Sep 2015 06:45 PM
@ booing

You truly are an idiot, aren't you?
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
21 Sep 2015 08:48 PM
And you are the bigger idiot For responding to me especially when i wasnt talking to you, Looks like you need to read my post too.
Report Abuse
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
22 Sep 2015 07:04 PM
Scripting Helpers no longer exists and lmad isnt the place for this anyway?
Report Abuse
notfruit is not online. notfruit
Joined: 21 Sep 2012
Total Posts: 1386
22 Sep 2015 07:07 PM
the only way I know how you could round is using an atrocious regex hack (casting to str, then using regex, modifying string, and back to int)

You don't need to wrap the Color3 constructor. If you do it everyone will laugh at you.
Report Abuse
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
22 Sep 2015 07:08 PM
What are you talking about? I just want a bunch of simple functions such as the ones I have.
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
22 Sep 2015 07:17 PM
module.numbersOnly = function(string)
if ((not string) or (type(string) ~= "string")) then return (string and type(string) == "number" and string or 0) end
return (tonumber(string) or tonumber(string:match("%-?%d+%.?%d*")) or 0)
end

module.assetExists = function(Asset, AssetType) -- 15 is audio
return pcall(function()
local AssetTypeId = MarketplaceService:GetProductInfo(Asset).AssetTypeId
if AssetTypeId == AssetType then
return true
else
return false
end
end)
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Sep 2015 07:18 PM
Oh god no, only check with tonumber
Report Abuse
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
22 Sep 2015 07:20 PM
@climax

I have no idea what the first function is used for and the second function is beyond useless because I check my assets before I put them into the game.
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
22 Sep 2015 07:40 PM
the first function is used to reduce a string to only numbers and the second function is useful if the asset is entered by a client
Report Abuse
Pinkerten is not online. Pinkerten
Joined: 03 Aug 2014
Total Posts: 840
22 Sep 2015 07:42 PM
thats a terrible function #number1


["tonumbers"] = function(string)
return string.byte(string,1,#string)
end
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
22 Sep 2015 11:10 PM
that's not what i meant stop being a nob

> "hey this is my 6th time"
> 6

and yeah it could be shortened a tad but i didn't take the time to revise it
Report Abuse
ThatChristianGuy is not online. ThatChristianGuy
Joined: 14 Jun 2014
Total Posts: 1283
22 Sep 2015 11:20 PM
here's a handy one. not to go in the module, to go right after the module is declared.

setmetatable(module, {
__call = function(self)
local fenv = getfenv(2)
for Name, Value in pairs(self) do
fenv[Name] = Value
fenv[Name:lower()] = Value
end
end;
})

Then you can require it like require(module)() and everything is in your fenv


Also

function cutout(string, substring)
string:gsub(substring, '')
end


--ThatChristianGuy is lonely. Join me on http://www.roblox.com/Forum/ShowPost.aspx?PostID=123008267
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