You are not logged in.
Pages: 1
Is it possible to directly select an element of an array returned by a function? I had problems using these:
Match := SubMatchesRegEx(Input, Find, True)[2];
Name := GetMarkedFiles[5];
Name := GetMarkedFiles()[1];
So I first had to assign the array to a variable of type TWideStringArray.
I build an enum type for the different log levels. To compare them I use Ord(LogLevel). But printing their names wasn't as expected. I had to build a lookup array:
type
TLogLevel = (FATAL, ERROR, WARN, INFO, DEBUG, TRACE);
const
LOG_LEVEL_NAMES = 'FATAL,ERROR,WARN,INFO,DEBUG,TRACE';
var
Logging_LogLevelToStr: TWideStringArray;
LogLevel: TLogLevel;
LevelText: WideString;
begin
Logging_LogLevelToStr := WideSplitString(LOG_LEVEL_NAMES, ',');
LogLevel := DEBUG;
LevelText := Logging_LogLevelToStr[Ord(LogLevel)];
end.
How to improve this? Found texts about TypeInfo from typinfo. But these were not working ...
Last edited by jogiwer (2022-12-06 23:31)
Offline
Accessing array elements
You'll need to assign the returned array to a variable, and then you can access individual elements through that variable. No shortcuts here unfortunately.
Retrieving names of enumeration members
Pascal Script supports only some of the features normally found in proper compilers, and type information isn't one of them.
Offline
OK, so I did it the best way I actually could handle it.
Unfortunately documentation about Pascal Script is hard to find. Most questions are answered on Pascal itself. But it seems undocumented what Pascal Script is not able to do.
So the only way proof some code fragments its just by putting them into the scripts
There also seems to be no IDE for Pascal Script either - so I'm stuck to ReNamer.
Offline
Pages: 1