Skip to content

Commit b0eed45

Browse files
committed
allow printing of square brackets.
For [ use [[], you can use ] safely as long as you don't have an open bracket from a command that has not been closed.
1 parent 369499a commit b0eed45

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

example/library/slog-text.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,9 @@ function M:send(text, wrap_num, show_all)
271271
local command_word = false -- Special Character is always off at the start of any new string processing
272272
for i = 1, #text do -- For each character in the string, do the following
273273
local character = text:sub(i, i) -- Separate the character -- TODO UTF8Fix, for now use the insert commands [|ò]
274+
local next_character = text:sub(i+1, i+1) -- Separate the character -- TODO UTF8Fix, for now use the insert commands [|ò]
274275
character = convert_special_character(character) -- Convert any special characters
275-
if character == special_character[1] then -- If it's the first special character, confirm that
276+
if character == special_character[1] and next_character ~= special_character[1] then -- If it's the first special character, confirm that
276277
command_word = true -- all should be combined until the second special character
277278
self.table_string[#self.table_string + 1] = "" -- Create the next table entry as an empty string
278279
end
@@ -1191,6 +1192,7 @@ M.command_table = {
11911192
self.cursor.x = self.cursor.x + undefined_image:getWidth()
11921193
end
11931194
end,
1195+
11941196
-----------------------------------------------------------------------------
11951197
-- Sound Commands
11961198
-----------------------------------------------------------------------------

example/main.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ example8box:send("[function=example.bop=true]Did you hear about the [color=#FF00
179179
example9box = Text.new("left", { color = {0.9,0.9,0.9,0.95}, shadow_color = {0.5,0.5,1,0.4}, font = Fonts.comic_neue_small, character_sound = true, print_speed = 0.04, sound_every = 2, sound_number = 4})
180180
example9box:send("Hello! Welcome to the world of Pocket Creatures![waitforinput][scroll][newline]My name is Professor Tree![newline][waitforinput][scroll][scroll]And you are?", 150, false)
181181
example10box = Text.new("left", { color = {0.9,0.9,0.9,0.95}, shadow_color = {0.5,0.5,1,0.4}, font = Fonts.monogram_extended_custom, character_sound = false, keep_space_on_line_break=true, modify_character_width_table = {["j"] = -1, }})
182-
example10box:send("Special Sheep Polution Test, Bahhh:\n\nij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij\n\na a a a a a a a a a a a a a a a a a a a a a a a a\n\nI've dropped so many letters oh no!\nOjan Pjan Ajan Testj Characterj oj mh wj ikj applej orangej colaj Martijn..", 540, true)
182+
local sp_test_string = "[shake][[]color=red][/shake]"
183+
example10box:send("Special Sheep Polution Test, Bahhh:\n\nij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij ij\n\na a a a a a a a a a a a a a a a a a a a a a a a a\n\nI've dropped so many letters oh no!\nOjan Pjan Ajan Testj Characterj oj mh wj ikj applej orangej colaj Martijn..\n" .. sp_test_string, 540, true)
183184
end
184185

185186
--[[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------]]--
@@ -353,6 +354,9 @@ function love.update(dt)
353354
if example.display_mode == 9 then
354355
example9box:update(dt)
355356
end
357+
if example.display_mode == 10 then
358+
example10box:update(dt)
359+
end
356360
end
357361

358362
--[[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------]]--

0 commit comments

Comments
 (0)