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
 

Why does this work?

Previous Thread :: Next Thread 
beanbeanz is not online. beanbeanz
Joined: 23 Oct 2007
Total Posts: 506
15 Nov 2015 04:54 PM
I saw chimmic do this in a codepad ( http://codepad.org/2E3lms6N )
local s = string.format("%0.3f " .. Formats[i][1],n/Formats[i][2]):gsub("%....",sub)

the sub is a function, with a possible argument. The script works, but how does the function know what argument to use?

This is the sub function:
local sub = function(match)
if match == ".000" then
return ""
else
return match:reverse():gsub("0",""):reverse()
end
end
Report Abuse
isaacsoccer is not online. isaacsoccer
Joined: 22 Jul 2010
Total Posts: 430
15 Nov 2015 05:04 PM
Probably because of local s = string.format("%0.3f " .. Formats[i][1],n/Formats[i][2]):gsub("%....",sub)
otherwise it is magic
Report Abuse
beanbeanz is not online. beanbeanz
Joined: 23 Oct 2007
Total Posts: 506
15 Nov 2015 05:45 PM
do you even know the question
I want to know why the sub function works ( and knows which numbers to use ) without an argument provided
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