aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_char_blob.lua
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-04 15:21:44 +0200
committerGitHub <noreply@github.com>2019-07-04 15:21:44 +0200
commit5835398152b3584b381dcce751b4a53ae634c4d2 (patch)
tree327ce2688321a814e8df96fdcce26a5fe72cfaca /src/nvim/generators/gen_char_blob.lua
parentf668f0afb24782aab36c8538f78823598c1f11e3 (diff)
parent32361a1245d1584ae074702aa645bc20e353f787 (diff)
downloadrneovim-5835398152b3584b381dcce751b4a53ae634c4d2.tar.gz
rneovim-5835398152b3584b381dcce751b4a53ae634c4d2.tar.bz2
rneovim-5835398152b3584b381dcce751b4a53ae634c4d2.zip
Merge pull request #10414 from blueyed/luacheck
Improve luacheck integration, fix more issues.
Diffstat (limited to 'src/nvim/generators/gen_char_blob.lua')
-rw-r--r--src/nvim/generators/gen_char_blob.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/generators/gen_char_blob.lua b/src/nvim/generators/gen_char_blob.lua
index d860375e26..1702add2e4 100644
--- a/src/nvim/generators/gen_char_blob.lua
+++ b/src/nvim/generators/gen_char_blob.lua
@@ -13,16 +13,17 @@ local source_file = arg[1]
local target_file = arg[2]
local varname = arg[3]
-source = io.open(source_file, 'r')
-target = io.open(target_file, 'w')
+local source = io.open(source_file, 'r')
+local target = io.open(target_file, 'w')
target:write('#include <stdint.h>\n\n')
target:write(('static const uint8_t %s[] = {\n'):format(varname))
-num_bytes = 0
-MAX_NUM_BYTES = 15 -- 78 / 5: maximum number of bytes on one line
+local num_bytes = 0
+local MAX_NUM_BYTES = 15 -- 78 / 5: maximum number of bytes on one line
target:write(' ')
+local increase_num_bytes
increase_num_bytes = function()
num_bytes = num_bytes + 1
if num_bytes == MAX_NUM_BYTES then
@@ -33,7 +34,7 @@ end
for line in source:lines() do
for i = 1,string.len(line) do
- byte = string.byte(line, i)
+ local byte = string.byte(line, i)
assert(byte ~= 0)
target:write(string.format(' %3u,', byte))
increase_num_bytes()