Embedding Behl in C++
Learn how to embed the Behl scripting language in your C++ application.
Quick Start
#include <behl/behl.hpp>
int main() {
behl::State* S = behl::new_state();
behl::load_stdlib(S);
behl::load_string(S, "print('Hello from Behl!')");
behl::call(S, 0, 0);
behl::close(S);
return 0;
}
Guides
- Getting Started - State management and basic setup
- Stack Operations - Working with the stack
- Calling Functions - Load and execute code
- Tables - Create and manipulate tables
- Userdata - Wrap C++ objects for scripts
- Error Handling - Handle errors gracefully
- Creating Modules - Build reusable C++ modules
- Debugging - Debug API for tools
- API Reference - Complete function list
Philosophy
The behl C++ API is designed to be:
- Familiar - Similar to Lua’s C API
- Modern - Leverages C++20 features
- Type-safe - Strong type checking with UIDs
- Simple - Easy to integrate and use