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 |
|
|
| 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
|
  |
| 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 |
|