3

I'm currently using the C API call luaL_loadstring() to load a chunk, but this call doesn't have a way of naming the chunk.

Is there a way of naming a chunk after it's loaded?

Alternatively, I see the lua_load() function takes a chunkname parameter, but I haven't found any examples of how to use it: How can I replace a luaL_loadstring() call with lua_load()?

Roddy
  • 66,617
  • 42
  • 165
  • 277

1 Answers1

6

Use luaL_loadbuffer(L,s,strlen(s),name).

lhf
  • 70,581
  • 9
  • 108
  • 149