Skip to content

Fix #116: Need using load_file, a callback is needed to provide special implementation.#683

Merged
lefticus merged 2 commits intoChaiScript:developfrom
leftibot:fix/issue-116-need-using-load-file-a-callback-is-neede
Apr 15, 2026
Merged

Fix #116: Need using load_file, a callback is needed to provide special implementation.#683
lefticus merged 2 commits intoChaiScript:developfrom
leftibot:fix/issue-116-need-using-load-file-a-callback-is-neede

Conversation

@leftibot
Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #116: Add set_file_reader callback for custom file loading
Add a customizable file reader callback to ChaiScript_Basic, following
the same pattern as set_print_handler. When set, the callback is invoked
instead of the default filesystem read, enabling use cases like encrypted
files, in-memory virtual filesystems, or platform-specific file access
(e.g., Android assets). The callback is settable from both C++ and
ChaiScript.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Files

 include/chaiscript/language/chaiscript_engine.hpp | 21 +++++++++++-
 unittests/compiled_tests.cpp                      | 39 +++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)

Closes #116

Triggered by @lefticus.

Add a customizable file reader callback to ChaiScript_Basic, following
the same pattern as set_print_handler. When set, the callback is invoked
instead of the default filesystem read, enabling use cases like encrypted
files, in-memory virtual filesystems, or platform-specific file access
(e.g., Android assets). The callback is settable from both C++ and
ChaiScript.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@lefticus
Copy link
Copy Markdown
Member

@leftibot fix merge conflicts from chaiscript/chaiscript:develop and update documentation for this feature.

Merge upstream chaiscript/chaiscript:develop, resolve conflict in
compiled_tests.cpp, add Custom File Loading section to cheatsheet.md,
and add release notes entry for set_file_reader.

Requested by @lefticus in PR ChaiScript#683 review.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@leftibot
Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

2ee40d87 Address review: merge develop and add set_file_reader documentation
bb069190 Fix #677: Add strong typedefs (#680)
1df1b4ad Fix #19: Add enum support (#679)
9ff56426 Fix #552: Feature-request: nested namespaces (#675)
092ec417 Fix #628: Grammar railroad diagram (#673)

@lefticus lefticus merged commit 1cbbba3 into ChaiScript:develop Apr 15, 2026
21 of 22 checks passed
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

Successfully merging this pull request may close these issues.

Need using load_file, a callback is needed to provide special implementation.

2 participants