Comments (5)
Well, there is sub_string
that does something similar...
The actual implementation may be quite involved, since indexer for strings cannot be overridden. It is built-in. Internally it uses mutable references to do its magic. For example, if we implement this correctly for strings, you can do this:
let s = "abcdefg";
s[1..3] = "xyz"; // you can even modify a sub-range inside a string!
print(s); // prints `axyzdefg`
When Rhai was first developed, ranges were not in, so this feature was left uncoded.
It should be similar to how indexing into a string to get at a single character would work:
let s = "abcdefg";
s[1] = 'x';
print(s); // prints `axcdefg`
from rhai.
You may look into the Target
type to see how character indexing is done, and then adapt it to ranges if you want a shot at it?
from rhai.
May you have time to review the pr: #845 ?
from rhai.
Will do that tomorrow
from rhai.
There are a few odds and ends that you missed, which I'll fix and update with a new drop.
from rhai.
Related Issues (20)
- Add a no_plugin feature HOT 7
- Issue with `CustomType` getters HOT 2
- Customizing "let", syntax
- Customizing "let", "fn" syntax HOT 4
- Object definition syntax HOT 2
- on_var not called for variables in closures HOT 6
- `NativeCallContext` in `export_module` results in a "hidden lifetime parameters in types are deprecated" warning HOT 7
- Pre-compile scripts? HOT 6
- The `sync` feature flag is not compatible with `no_std` HOT 1
- Willingness to offer alternative Map types behind feature flags? HOT 1
- Rhai `no_std` appears to rely on `once_cell/alloc` but does not request it HOT 2
- Could you consider removing the semicolons at the end of the lines HOT 5
- Defining a pipeline operator? HOT 2
- min(f64, f64) function not found HOT 2
- A memory leak was discovered HOT 1
- A stack overflow vulnerability was found HOT 3
- [Question] Is there a way to turn a value with a lifetime into a `Dynamic` HOT 5
- Add `position` to `EvalAltResult::SystemError` HOT 1
- on_debug callback not presenting source HOT 4
- Defining operators for CustomType HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhai.