Problem with Lua error messages

BlitzMax Forums/BlitzMax Programming/Problem with Lua error messages

JoshK(Posted 2009) [#1]
Sometimes Lua error messages will have the path cut off like this (not a real error):

...am Files/whatever/test.lua : Error in something; Nil value : 135

Why does this happen? Is the string too long? Is there some constant that controls the max length of a string?


_Skully(Posted 2009) [#2]
How are you receiving the message?

Seeing the ".." I would assume means that some intermediary step is truncating it. I can't see the source producing a message like that.


JoshK(Posted 2009) [#3]
BlitzMax program:
Local L:Byte Ptr=luaL_newstate()
If luaL_dofile(L,AppDir+"/test.lua")<>0
	Print lua_tostring(L,-1)
EndIf

Lua script (test.lua):
sdfsdfdsfsdfsdfds()

Place these two files anywhere in a directory that is fairly deep down and run. Here is my output:

...ogram Files (x86)/WinRAR/Formats/New folder/test.lua:1: attempt to call global 'sdfdsfds' (a nil value)



_Skully(Posted 2009) [#4]
I don't use LUA yet, but a quick google brought this up... look for MAX_PATH, paths longer than MAX_PATH will be truncated.

I'd guess that luaL_dofile truncates the length based on MAX_PATH when returning the error.


JoshK(Posted 2009) [#5]
The only mention I can find of MAX_PATH is in loadlib.c:
  char buff[MAX_PATH + 1];

Where is it defined?


_Skully(Posted 2009) [#6]
It looks like it comes from the OS... I saw mention of defining MAX_PATH on non Windows OS's. Is there no way for you to use a relative path?


skidracer(Posted 2009) [#7]

/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@* of a function in debug information.
** CHANGE it if you want a different size.
*/
#define LUA_IDSIZE 60



will leave it for the reader to locate particular conf file (it's a .h)


JoshK(Posted 2009) [#8]
Thanks, that works! It's located in "luaconf.h".


JoshK(Posted 2012) [#9]
You also have to change "MAXSRC" from 80 to 1024 in "llex.c"