Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return nil when read_file not found file #113

Open
Intemporel opened this issue Dec 26, 2021 · 3 comments
Open

Return nil when read_file not found file #113

Intemporel opened this issue Dec 26, 2021 · 3 comments

Comments

@Intemporel
Copy link

I think we can add return nil or something like that here :

throw script_exception("read_file","no such file:" + std::string (path));

And in script we can now use read_file like that :

local myFile = read_file(path)

if ( myFile ) then
    ...
end
@Intemporel
Copy link
Author

      if (!fs::exists(path))
      {
        //throw script_exception("read_file","no such file:" + std::string (path));
        return false;
      }

@ihm-tswow
Copy link
Collaborator

you have this: https://github.com/wowdev/noggit3/blob/default/scripts/docs/api/modules.md#path_exists

but could probably make two differentiating files and folders as well.

@Intemporel
Copy link
Author

i see this too late, lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants