Problem with Lua error messages
BlitzMax Forums/BlitzMax Programming/Problem with Lua error messages
| ||
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? |
| ||
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. |
| ||
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) |
| ||
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. |
| ||
The only mention I can find of MAX_PATH is in loadlib.c:char buff[MAX_PATH + 1]; Where is it defined? |
| ||
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? |
| ||
/* @@ 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) |
| ||
Thanks, that works! It's located in "luaconf.h". |
| ||
You also have to change "MAXSRC" from 80 to 1024 in "llex.c" |