title: How to run lua bytecode from variable?
body: <p>So I am working on a custom lua bytecode thing and when i run this code nothing happens but if i print the dec variable and then copy it and do loadstring(&quot;long bytecode thing&quot;)() then it works but not with my thing, could someone pelase point out what is wrong?</p>
  <pre><code>local OVal = 999
  local SVal = 754
  
  local function customEnc(STR)
      local currentVar = &quot;&quot;
      local strings = {}
      STR:gsub(&quot;.&quot;, function(c)
          if c == [[\]] then
              local newVar = tonumber(currentVar)
              if newVar == nil then
              else
                  newVar = newVar * OVal /SVal
                  table.insert(strings, tostring(newVar))
                  newVar = &quot;&quot;
              end
              currentVar = &quot;&quot;
          else
              currentVar = currentVar .. c
          end
      end)
      local newString = &quot;&quot;
      for i,v in pairs(strings) do
          newString = newString .. [[\]] .. v
      end
      newString = newString .. [[\]]
      return newString
      end
      
      local function customDec(STR)
          local currentVar = &quot;&quot;
          local strings = {}
          STR:gsub(&quot;.&quot;, function(c)
              if c == [[\]] then
                  local newVar = tonumber(currentVar)
                  if newVar == nil then
                  else
                      newVar = newVar / OVal *SVal
                      table.insert(strings, tostring(newVar))
                      newVar = &quot;&quot;
                  end
                  currentVar = &quot;&quot;
              else
                  currentVar = currentVar .. c
              end
          end)
          local newString = &quot;&quot;
          for i,v in pairs(strings) do
              newString = newString .. [[\]] .. string.format(&quot;%.0f&quot;,v)
          end
          return newString
      end
  local enc = customEnc([[\112\114\105\110\116\40\34\72\101\108\108\111\32\87\111\114\108\100\34\41\10]])
  local dec = customDec(enc) .. [[\10]]
  loadstring(dec)()
  </code></pre>