So I was testing my API, but when I error it using:
error( "test" )It will write "<apiname>:<errorline>: test". That seems okay, but I would like to change the message so <apiname> becomes <programname> and <errorline> shows the line the program used my api. This way it would be easier for the API-users to look what they did wrong. I tried error( "test", 3 ), which would return "lua:52: test". According to the lua program thats fine; It runs func(), which should be the same as error( "test", 3 ), but this function ran inside a pcall() function (Confirmed, because error( "test", 2 ) will replace "<apiname>:<errorline>:" with "pcall:" ). But that's also the problem: There might be programs running using my API outside a pcall() environment, or running it using more than one pcall (bios:##:shell:##:<apiname>:## seems a bit overpowered).
The Question
Is there any easy way to print out my error nicely, or do I have to stick with my first try ( error( "test" ) )?
What should I use:
error( "test" ) error( "test", 1 ) error( "test", 2 ) assert( false, "test" ) -- equal to error( "test" )Or something else?
Edited by YoYoYonnY, 03 February 2014 - 02:59 PM.












