Lua string concatenation in Json blob -


i have question string concatenation.

i have example trying append value inside json block variable value

example:

clock = os.clock() body = "{\"name\":\"stringvalue\" .. clock }" print(body)  

when run following output:

{"name":"stringvalue" .. clock } 

what expecting

{"name":"stringvalue0.010117"} 

how make variables value added string?

this instance using [[ ]] delimited strings useful:

clock = os.clock() body = [[{"name":"stringvalue]] .. clock .. [["}]] print(body)  

to continue using double quoted string, variable assignment following (note how quote after stringvalue not escaped):

body = "{\"name\":\"stringvalue" .. clock .. "\"}" 

Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

Python website log in: BIG-IP can not find session information in the request -