Skip to content

String enums causes compilation error #366

@Aldrin-John-Olaer-Manalansan

Description

Tested enum:

Image

Case 1: Use enum as parameter of a command:

{$CLEO}
{$USE SAMPFUNCS}
NOP

if File fileAHandle = open_file {filePathName} "cleo:\cleo_plugins\SA.Math.cleo" {mode} FileMode.ReadBinary
then
    // do something
    close_file fileAHandle
end

{0A93:} terminate_this_custom_script

Image

Case 2: Use enum as conditional statement

{$CLEO}
{$USE text}
{$USE SAMPFUNCS}
NOP

int compareStr
// do something to store a stringpointer at comparePtr
if compareStr == FileMode.AppendText // <-- synonymous to Text.IsEqual(comparePtr,FileMode.AppendText)
then // both strings are equal
else // both strings aren't equal
end

terminate_this_custom_script

Image

Case 3: Use enum as a constant

{$CLEO}
{$USE SAMPFUNCS}
NOP

const FILEMODE = FileMode.WriteBinary

if File fileAHandle = open_file {filePathName} "cleo:\cleo_plugins\SA.Math.cleo" {mode} FILEMODE
then
    // do something
    close_file fileAHandle
end

terminate_this_custom_script

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions