That example worked. The problem was that I had RegisterScripterLibrary(TatWideStringsLibrary, true) in my code. (It was also in initilazion of ap_widestrings). Changing it to addLibrary helped. Code was originally written with d7 / scripter 2.6, so there might have been some changes... :)
Keep in mind that RegisterScripterLibrary doesn't register the library directly into scripter like AddLibrary. It just makes scripter aware of it. To effectively use the library you must add "uses WideStrings" to your script.