Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Christian Aguilera
@cristian64_gitlab
I've just learned that eval_file() (or eval(), or the operator()) can be evaluated several times. That is probably the answer to my previous question. A function execute() in ChaiScript can be defined with eval_file(), and then the function can be invoked several times, with different arguments, with chai("execute(interface);");
Peter Taylor
@emersont1
Hi,
On minGW I'm getting an object file too big error with the asm.exe, is there an easy fix for this?
(It doesn't affect MSVC or G++ on Linux)
Jason Turner
@lefticus
Yes, you must compile with at least -O1 on MinGW. It's, as far as I know, a bug in MinGW that has affected ChaiScript for at least 6 years. Also, you need to make sure you compile with threading disabled if you want to use MinGW (again, bugs in MinGW) @emersont1
Matthew Sanetra
@matthewsanetra
Hey guys, Im really confused on how to use this in my C++ project
Jason Turner
@lefticus
That's a really wide open statement. What exactly are you confused about?
Jonathan Gordon
@jdgordon
Hey, I'm using a rather older version (stuck on c++11), is use() expected to work with a folder heirachy? i.e if my script does "use("helpers/a.chai")" and then in helpers/a.chai I do "use("b.chai")", (expecting helpers/b.chai to be loaded).
Using version 5.7.0
Matthew Sanetra
@matthewsanetra
Hasn’t anyone got the latest version working with the Pre-Built library?
Rob Loach
@RobLoach
@jdgordon You'll need to interpret where the files are being loaded from. Relative won't work, unless you override how those functions owrk.
@rust4yy Later versions I find pretty fast, and haven't had a need to load from a pre-built.
Rob Loach
@RobLoach
@cristian64_gitlab Yes, with a wrapper class. Spiced did something similar: https://github.com/ChaiScript/Spiced/tree/master/src
Jason Turner
@lefticus
@rust4yy I don't even know the last time I uploaded a pre-built binary. It's been quite some time
Amos Bird
@amosbird
Hi, how is the performance of chaiscript compared to luajit?
Amos Bird
@amosbird
ChaiScript excels at calling C++ functions, not at math. does it mean chaiscript have no overheads when calling c++ functions or accessing c++ vectors?
Jason Turner
@lefticus
it has very low overhead when calling back into C++. You can get very good performance if you put all of your performance critical work in C++ then call it from ChaiScript. If performance is your 100% main concern you won't be happy with ChaiScript. If you want ease of use & and almost perfect interop with C++ choose ChaiScript. if you want performance and very good interop, choose sol2 for lua
Amos Bird
@amosbird
sol2 and lua still fails to meet my expectation
pavzia
@pavzia
I am brand new to chaiscript and trying to abandon lua, my first hurtle: from a C++ application, how do I load an external chaiscript file and run it ?
Sygmei
@Sygmei
@pavzia Use the eval_file method ?
ozan
@honamlioglu_gitlab
int doSome(const EqualityComparable&) what does & operator at the end of parameter
Za Ra Sa Ha
@Zrasha_gitlab
hahahahahahahahhaah
I just benchmarked Chaiscript, it's super slow
what a piece of garbage
Matt Godbolt
@mattgodbolt
I'd suggest you keep to constructive comments here, @Zrasha_gitlab
Za Ra Sa Ha
@Zrasha_gitlab
ChaiScript being so slow, it cannot be taken seriously and cannot be used for any real work. We have many lightweight alternatives with JIT and AoT
Matt Godbolt
@mattgodbolt
There are many tradeoffs. Not all platforms support JIT, nor is it always wanted. AoT is specifically a non-design for ChaiScript, as I understand it
Jason Turner
@lefticus
If speed is your primary concern ChaiScript is not the tool for you. This is common knowledge. If ease of use and tight integration with C++ is your primary concern then it is the tool for you.
Jason Turner
@lefticus
Good, then keep using your LLVM-Clang integration solution, it sounds like the perfect option for you
Za Ra Sa Ha
@Zrasha_gitlab
Chaiscript is also much slower than even the non-Jitted LUA.. You have a very, very low quality codebase
Jason Turner
@lefticus
We're always looking for contributors who can increase the quality and performance of the code. While maintaining the same flexibility, correctness, and crossplatform capability. So if you do go to add a contribution please make sure it can still work on ARM/i386/x86_64/MSVC/GCC/Clang/Libc++/libstdc++/Windows/Linux/MacOS/Haiku
frankturley
@frankturley
I am looking for a way to format numbers in a print statement in Chaiscript
Rob Loach
@RobLoach
@frankturley to_string() will port numbers to strings, but I'm unsure there's a native number_format() method. Feel free to consider adding one to https://github.com/chaiscript/chaiscript_extras .
frankturley
@frankturley
I was looking for an equivalent to Basic's Print Using, where for example Print Using "##.##"; 10.222 would output 10.22 - sorry I haven't a clue how to create this.
Rob Loach
@RobLoach
@frankturley ChaiScript supports template literals.....
var num = 10.222
print("Something: ${num}")
frankturley
@frankturley
My problem is that I am reading a variable which has 6 places of decimals, I would like to print it as a whole number.
Arthur Brainville
@Ybalrid
You can probably use a floor or ceil function. Or give a function int to_int(double n) { return n; } to your chai script engine from the C++ side ?
And you just use it when printing
frankturley
@frankturley
The host application is the property of another party. They allow access to its variables via ChaiScript files, which are called by the host. One of these variables holds miles per hour, and I would prefer to show this to the user as a round number, rather than the value as held by the host which has six decimal places.
Gibbon99
@Gibbon99

Hi - I've got an issue that I don't understand - hoping to get some insight into what I am doing wrong. I have a chai script with two functions - both exactly the same, I can call the first one fine, but the second one silently fails. I run .eval on the script first, then have a function containing this line "chaiInstance.eval<std::function<void ()>>(functionName);" - it only seems to work on the one function call ie: chai_runFunction("scriptFunc"); - and does nothing calling "chai_runFunction("printFromScript");". this is the script: def scriptFunc()
{
testGlobalVar = 555;
}

def printFromScript()
{
testGlobalVar = 9999;
}

Germán Diago
@germandiagogomez
Hello. I have been using ChaiScript for a while.
I did not find any problem with its speed for my use cases
but I am still wondering
if a speed boost could be achieved
by
making all the methods, etc.
being resolved in a different way
I think that currently, ChaiScript is using strings
for things that are immutable most of the time (method names, etc.)
wouldn't it be more effective to use some kind of immutable string and/or hashing for method resolution? Not sure, though, if this can be done. I do not know the design deeply