Author Topic: File handling in Squirrel | Debugging problems  (Read 1494 times)

aXXo

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
File handling in Squirrel | Debugging problems
« on: March 10, 2011, 03:14:18 pm »
Hey,
I need some help regrding Text files
What are the functions to read/write a string into a .txt file?
Does the C/C++functions work in squirrel?? like fwrite, fread etc....

I couldnt find them in Squirrel standard library. I need them for storing chat logs.
If there is a better way to store logs then please suggest that :)



Also.
I seem to have a problem with detecting syntax errors in the script. So Debugging takes too long.
If i use a keyword that does not exists in any library/module.....or in case i call a function that does not exists, the server does not pop up any error.
Same is the case with other noob typo errors, which happen a lot with me.
So it is hard to know which part of the script has error.

I did find something related to it on VCMP unofficial forums.
Please post some another example or some illustration regarding error detection.
Try wrapping try and catch around parts of your script, then reading the console window after the crash.

E.G.
Code: [Select]
function onScriptLoad()
{
      try{
           examplefunction();
           eDB <- ConnectSQL( "example.db" );
           }
           catch(e) print("onScriptLoad error: " + e);
}


Thanks'yo!!  :)

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: File handling in Squirrel | Debugging problems
« Reply #1 on: March 10, 2011, 04:38:40 pm »
Your first problem:
Try looking at this: http://www.iv-mp.com.br/download/scripts/easyini.nut

Second problem:
I have no idea why it doesn't give you errors, If I make a stupid typo I get the getVarInfo: Could not retrieve UserData
error, the filename and line it occurs..

 

© Liberty Unleashed Team.