aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_char_blob.lua
diff options
context:
space:
mode:
authorSameed Ali <sameedali94@gmail.com>2019-04-14 16:56:11 -0400
committerDaniel Hahler <git@thequod.de>2019-07-04 06:59:44 +0200
commit571b2c5e7be105d23ada987a7c7080f8631bfd15 (patch)
tree0c07e601c2f1e55525f81a5804a5ec992adaeef0 /src/nvim/generators/gen_char_blob.lua
parent99b870d61c0a574011d16886d2cea44d18c11a2d (diff)
downloadrneovim-571b2c5e7be105d23ada987a7c7080f8631bfd15.tar.gz
rneovim-571b2c5e7be105d23ada987a7c7080f8631bfd15.tar.bz2
rneovim-571b2c5e7be105d23ada987a7c7080f8631bfd15.zip
Fix luacheck errors for all Lua source files
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()