These are chat archives for ChaiScript/ChaiScript

8th
Jun 2017
Jerry Smith
@dean1012
Jun 08 2017 00:04
It doesn't like this:
{chaiscript::fun<void(const std::string, GameData *)>(&BinaryFileFormat::SaveFile), "SaveFile"}
it says missing call to bound pointer to member function
Jerry Smith
@dean1012
Jun 08 2017 00:18
nevermind, found my answer
Jerry Smith
@dean1012
Jun 08 2017 02:58
What does "guard evaluation failed with function method_exists mean?
Jerry Smith
@dean1012
Jun 08 2017 03:06
I'm trying to check if a Class method has been registered with Chai. I don't care if I check in C++ or in Chai
Jason Turner
@lefticus
Jun 08 2017 03:28
I guess I'd need more context, I would still expect any of those options to work
and I wouldn't expect a guard error in any case, I think
Jerry Smith
@dean1012
Jun 08 2017 03:28
I'm sure it's something I'm doing wrong. I keep switching things around in the chaiscript and get different errors each time so I'm thinking it's a logic issue or something
I just want to do a chai script that basically checks if the SaveFile method of XMLFileFormat class is recognized. If it is, I want to return true but NOT execute it. If it does not, I want it to return false.
Jason Turner
@lefticus
Jun 08 2017 03:29
so the fundamental thing you need to think about is that chaiscript doesn't actually know anything about methods
everything is a regular function
Jerry Smith
@dean1012
Jun 08 2017 03:30
I noticed that i can check if SaveFile() exists
Jason Turner
@lefticus
Jun 08 2017 03:30
myobj.do_thing() and do_thing(myobj) are equivalent
Jerry Smith
@dean1012
Jun 08 2017 03:30
ahh I see... then let me try that
Jason Turner
@lefticus
Jun 08 2017 03:33
ultimately what you are asking is: "does a function called "SaveFile" exist that happens to have a 1st parameter of type "XMLFileFormat"
that was giving the guard error BTW
I also tried: call_exists(SaveFile, XMLFileFormat)
call_exists doesn't give error but it does say "NO"
indicating it doesn't exist
Jason Turner
@lefticus
Jun 08 2017 03:36
this is on my todo list btw, to provide a more official built in way to detect methods
this plus reloading of scripts are the two main asked for things
I don't have the ability to look at it right this moment though
Jerry Smith
@dean1012
Jun 08 2017 03:37
It's fine
Jerry Smith
@dean1012
Jun 08 2017 03:49
Got it working finally!
var a = call_exists(<methodname>, <instantiated_class_var>, <param1>, <param2>);
Jason Turner
@lefticus
Jun 08 2017 03:56
cool