Last active
August 29, 2015 14:01
-
-
Save blindman2k/8c879b67a0074b58e631 to your computer and use it in GitHub Desktop.
vformat gives you the same functionality is format() but allows you to pass in parameters as an arbitrary length array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vformat(fmt,...) { | |
local args = [this,fmt]; | |
if (typeof(vargv[0]) == "array") { | |
vargv = vargv[0]; | |
} | |
args.extend(vargv); | |
return format.acall(args); | |
} | |
// ----------------------[ Example use ]---------------------- | |
function log(aformat, ...) { | |
server.log(vformat(aformat, vargv)); | |
} | |
log("%s, %s!", "Hello", "world"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment