Interactive use of Chaiscript


#1

Does anyone have experience with using Chaiscript interactively; so to also link it up with autocompletion and get something like a shell like experience?
I’m considering to use expose a configuration and control interface interactively and would like to know if Chaiscript could was already used this way (or if this is a viable idea in general :slight_smile:)

thx & cheers
Philipp


#2

Sounds like a great experiment. What autocompletion do you use? Could have it set up in Bash, zsh, fish, would be neat to have it in a shell.


#3

Don’t have autocomplete yet but I use chaiscript interactivly


#4

I am currently also started to integrate chaiscript into a little framework I’m putting together (just OpenGL + SDL + ImGui and a bunch of little other things - nothing fancy)

I’ve just started hooking a console window to a chaiscript interpretor, and started defining functions it can use, and I’m also wondering if, and how, I could have some kind of auto-complete on the inputs.

Does anyone know if there’s a good way to iterate through the functions and variable defined and accessible form the chaiscript instance?

I haven’t started digging yet (spent the bulk of my time on this wiriting bindings to the most useful parts of GLM…)


#5

#6

I managed to extract the list of accessible symbols from the chaiscript state, and I’m starting to get a pretty “good feeling” interactive terminal in that game engine thingy I’m messing with.

For now when TAB is pressed I’m just getting the last word/symbol currently being typed in the input string, and look for things that start with that sub-string, if there’s only one I autocomplete, if not, I just print the list of possibilities to the console.

I spent a little bit too much time just playing with it, it makes for a cool little interactive quake-style drop down terminal:

So yeah, to answer @prospero, it’s more than a viable idea, and you can have auto-completion, you just have to write the logic yourself for that, and a naive aproach like the one described above seems to be a good starting point. It’s not as awesome as like, Zsh, but it’s not bad at all!