This maybe a LUA bug rather than FH but if I do:
fhSetValueAsText(objFILE, 'C:UsersTestPicturesbag.jpg')
LUA sets the objFILE value to:
C:UsersTestPictures[?]ag.jpg
(where ? is a strange character rendered as a black box with a circle in it)
This can be seen in the debug variables window and is also the value put into the multimedia record in FH.
ID:5836
* Strange characters in LUA strings
Strange characters in LUA strings
PS: I have only noticed this since 5.0.0.5. I *believe* it was working OK before but cannot guarantee it.
- SimonOrde
- Program Designer
- Posts: 352
- Joined: 18 Nov 2002 10:20
- Family Historian: V7
- Location: Calico Pie
Strange characters in LUA strings
This isn't a bug - it's a feature of Lua. Within Lua, the backslash character '' has a special role in strings (as it does in other programming languages like C and C++). For example, 'n' means the newline character and 't' means a tab character. If you want to put a backslash into a string, you have to double it up to remove its special meaning. i.e. the line you needed was this:
fhSetValueAsText(objFILE, 'C:\Users\Test\Pictures\bag.jpg')
If you use that, the correct value 'C:UsersTestPicturesbag.jpg' will be inserted.
In case anyone reading this doesn't know what a 'string' is, incidentally, it means text in quotes.
fhSetValueAsText(objFILE, 'C:\Users\Test\Pictures\bag.jpg')
If you use that, the correct value 'C:UsersTestPicturesbag.jpg' will be inserted.
In case anyone reading this doesn't know what a 'string' is, incidentally, it means text in quotes.
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Strange characters in LUA strings
Just to add to this, the escaping of the is only needed if you are entering the string directly in the source code, if you are prompting for a file name or obtaining it from iup.getfile or similar it can be entered as normal.
This is detailed on the Lua Quickstart page in the plugin help.
This is detailed on the Lua Quickstart page in the plugin help.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."