Re: LuaL_loadbuffer doesn't appear to use name parameter for error messages

  • From: Sam Putman <atmanistan@xxxxxxxxx>
  • To: LuaJIT <luajit@xxxxxxxxxxxxx>
  • Date: Sat, 11 May 2019 13:13:19 +0200

On Sat, May 11, 2019 at 1:07 PM Sam Putman <atmanistan@xxxxxxxxx> wrote:


Thanks, this was the prompt I needed to figure out what was going on.

For the sake of others who may encounter this difficulty:

bytecode generated with `string.load(fn)` (note the lack of a second
parameter) and loaded with LuaL_loadbuffer will ignore the value of `*name`
and give it a generic [string "..."] name instead.

if instead one uses `string.load(fn, "")`, the string contents doesn't
matter
because LuaL_loadbuffer will use whatever string one passes it in `*name`.


Er, this was a bit off-the cuff.

What I meant was `string.dump(fn, ""))`.

Other related posts: