Advertisement
TriiNoxYs

[ComputerCraft] safeString

Apr 1st, 2016
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.35 KB | None | 0 0
  1. local function safeString(text)
  2.                 local newText = {}
  3.                 for i = 1, #text do
  4.                         local val = text:byte(i)
  5.                         newText[i] = (val > 31 and val < 127) and val or 63
  6.                 end
  7.                 return string.char(unpack(newText))
  8.         end
  9.  
  10. print(safeString("é")) --Will print "??"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement