Last active
January 4, 2022 09:48
-
-
Save mnikn/3b623e8e8cea108de049ea87ebc3c62c to your computer and use it in GitHub Desktop.
pico-8 utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wrap_text(content,max_count) | |
local lines={''}local wcount=0 | |
for i=1,#content do | |
local c=sub(content,i,i) | |
lines[#lines]..=c | |
wcount+=1 | |
if (wcount>=max_count) | |
then | |
wcount=0 | |
lines[#lines]..='\n' | |
lines[#lines+1]='' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment