summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <jeija@mesecons.net>2014-04-24 10:47:21 +0200
committerJeija <jeija@mesecons.net>2014-04-24 10:48:18 +0200
commitfa3f9ce09d2fae405a5e067db5e4996b6523bcee (patch)
tree4b2f930252990cc2fac6a1af5063e6eea3e8c55d
parent190278bc786d49c56c91e1feda6feee70c5e8e3b (diff)
parentadb41d4e2a3aeaa01e127ed78cd9560cf3ce0e0e (diff)
Merge branch 'master' of https://github.com/Jeija/minetest-mod-digilines
-rw-r--r--digilines_lcd/characters3
-rw-r--r--digilines_lcd/init.lua25
-rw-r--r--digilines_lcd/textures/_co.pngbin0 -> 135 bytes
3 files changed, 4 insertions, 24 deletions
diff --git a/digilines_lcd/characters b/digilines_lcd/characters
index 83d6505..b36eea4 100644
--- a/digilines_lcd/characters
+++ b/digilines_lcd/characters
@@ -250,6 +250,9 @@ _eq
;
_sm
1
+:
+_co
+1
,
_cm
2
diff --git a/digilines_lcd/init.lua b/digilines_lcd/init.lua
index bcd9e47..fa02197 100644
--- a/digilines_lcd/init.lua
+++ b/digilines_lcd/init.lua
@@ -141,34 +141,11 @@ local NUMBER_OF_LINES = 5
local LINE_HEIGHT = 14
local CHAR_WIDTH = 5
-string_to_array = function(str)
- local tab = {}
- for i=1,string.len(str) do
- table.insert(tab, string.sub(str, i,i))
- end
- return tab
-end
-
-string_to_word_array = function(str)
- local tab = {}
- local current = 1
- tab[1] = ""
- for _,char in ipairs(string_to_array(str)) do
- if char ~= " " then
- tab[current] = tab[current]..char
- else
- current = current+1
- tab[current] = ""
- end
- end
- return tab
-end
-
create_lines = function(text)
local line = ""
local line_num = 1
local tab = {}
- for _,word in ipairs(string_to_word_array(text)) do
+ for word in string.gmatch(text, "%S+") do
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then
if line ~= "" then
line = line.." "..word
diff --git a/digilines_lcd/textures/_co.png b/digilines_lcd/textures/_co.png
new file mode 100644
index 0000000..b161819
--- /dev/null
+++ b/digilines_lcd/textures/_co.png
Binary files differ