Warning: file_get_contents(http://localhost:8000/calc?cmd=514&userid=0&debug=1): failed to open stream: Cannot assign requested address in /var/www/tb/show-snippet.php on line 158
String format test (%100s) [514]

Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #514 // String format test (%100s)

Lua code - System test

s = ("%99s"):format("hello")
print("|"..s.."|")
assert(#s == 99, #s)

--[[
s = ("%100s"):format("hello")
print("|"..s.."|")
assert(#s == 100)
]]

return true

Author comment

Doesn't work in LuaJ out of the box... hm.

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #514
Snippet name: String format test (%100s)
Eternal ID of this version: #514/1
Text MD5: 6de846e58ffd9eb538a9ed659a5b550f
Author: stefan
Category:
Type: Lua code - System test
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-11 14:44:05
Source code size: 167 bytes / 11 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1136 / 175
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)