roaddog Posted August 15, 2014 Share Posted August 15, 2014 guiSetText ( GUIEditor.label[1], [[Name: "..playername.." UpTime:"..getElementData(thePlayer, "UpTime").." Occupation: "..getElementData(thePlayer, "Occupation")" Health: "..getElementHealth(thePlayer).." Group: "..getElementData(thePlayer, "Group")" Group Rank: Cash: "..getPlayerMoney(thePlayer)" Wanted Level: "..getPlayerWantedLevel(thePlayer).." nCountry: ]]) Hai How to do this thing? can anyone correct me ? Link to comment
Et-win Posted August 15, 2014 Share Posted August 15, 2014 I think instead of " [[ or ]] too, but not sure. Link to comment
cheez3d Posted August 15, 2014 Share Posted August 15, 2014 local String = [[Name: %s UpTime: %s Occupation: %s Health: %d Group: %s Group Rank: %s Cash %d Wanted Level: %d Country: %s]]; guiSetText(GUIEditor.label[1],String:format(playername,getElementData(thePlayer,"UpTime"),getElementData(thePlayer,"Occupation"),getElementHealth(thePlayer),getElementData(thePlayer,"Group"),getElementData(thePlayer,"GroupRank"),getPlayerMoney(thePlayer),getPlayerWantedLevel(thePlayer),getElementData(thePlayer,"Country"))); Link to comment
roaddog Posted August 15, 2014 Author Share Posted August 15, 2014 Oh Thanks could you explain what %s and %d do? Link to comment
cheez3d Posted August 15, 2014 Share Posted August 15, 2014 Lua makes use of the C string formatting. %d represents a digit and %s represents an array of characters. http://www.cplusplus.com/reference/cstdio/printf/ When you do print(("%d"):format(10)) it will print 10 instead of %d (it replaces %d with 10). When you do print(("String: %s"):format("This is my string!")) it will print "String: This is my string!" instead of "String: %s". Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now