Author Topic: Need help with ".file_name.length ()" please  (Read 286 times)

Arcadefan1

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Need help with ".file_name.length ()" please
« on: February 11, 2018, 04:19:06 AM »
Can someone please tell me why my code doesn't work? I want to do stuff when the length of a filename is larger then zero. Basically it should do stuff if the file is existing... the "if" statement always equals zero. Can someone tell me how to get the length of the filename?

Code: [Select]
Picture [ "pic" ] <- surface.add_artwork (config "image",0,0,surface.width,surface.height)

If Picture [ "pic" ].file_name.length() > 0
{
// do stuff
}


Daeymon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Need help with ".file_name.length ()" please
« Reply #1 on: February 11, 2018, 12:40:50 PM »
Try:
Code: [Select]
if (Picture [ "pic" ].file_name.len() > 0)
{
    // do stuff
}

Arcadefan1

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Need help with ".file_name.length ()" please
« Reply #2 on: February 11, 2018, 10:03:22 PM »
Ah, ok. I wrote the lines from my memory here, so I guess I just forget the braces. Sorry. I think it has something to do with the way it references to the table "pictures". The code works, when used on a normal variable. But thx for pointing it out.