From 3813f2d43054708bab7221a5ca74a0183a2ebcaf Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 30 Mar 2017 11:58:09 +0200 Subject: 8-bit only in lstrlib --- src/lua.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lua.js') diff --git a/src/lua.js b/src/lua.js index 85d4b64..d4f620b 100644 --- a/src/lua.js +++ b/src/lua.js @@ -4,6 +4,12 @@ const assert = require('assert'); const luaconf = require('./luaconf.js'); +// To avoid charCodeAt everywhere +const char = []; +for (let i = 0; i < 127; i++) + char[String.fromCharCode(i)] = i; +module.exports.char = char; + /* mark for precompiled code ('Lua') */ const LUA_SIGNATURE = "\x1bLua"; -- cgit v1.2.3-54-g00ecf