lua string printing

Posted by anon on Stack Overflow See other posts from Stack Overflow or by anon
Published on 2010-05-01T00:25:06Z Indexed on 2010/05/01 0:37 UTC
Read the original article Hit count: 270

Filed under:
|

In C, I have format strings, something like:

char *msg = "wlll you marry me"
fprintf(stderr, "%s, %s?", name, msg);

Now, can I do something similar in lua with format strings? I.e. I want something functionally equivalent to:

name .. ", " .. msg .. "?"

but not so ugly, in lua.

Okay, so I can do string.format("%s, %s?", name, msg), but can I go even a step further, something like perl style, where I can go:

"%name, %msg?"

Thanks!

© Stack Overflow or respective owner

Related posts about lua

Related posts about format-string