These are chat archives for ChaiScript/ChaiScript

5th
Mar 2018
Tharindu Mathew
@mackiem
Mar 05 2018 21:44
def waypoint_goal(my, v, count) {
var goal_vel = vec3();
if (!my.path.empty()) {
var move = (a.path[0] - a.position);
I have a path variable which is essentially, a std::vector<glm::vec3>
but i'm running into some issues of overloads when trying to call vector related methods

Error: "Error with function dispatch for function 'empty'" With parameters: (class std::vector<struct glm::tvec3<float,0

,class std::allocator<struct glm::tvec3<float,0> > >).() during evaluation at (agent.chai 41, 10)

10 overloads available:
().()
(const Vector_Range).()
(const Const_Vector_Range).()
(const string_Range).()
(const Const_string_Range).()
(const Map_Range).()
(const Const_Map_Range).()
(const string).()
(const Vector).()
(const Map).()

agent.chai (41, 10) 'my.path.empty()'
from agent.chai (41, 9) '!my.path.empty()'
from agent.chai (41, 9) '!my.path.empty()var move=(a.path[0] - a.position)var len=length(move)var norm=(len > 1e-3)pow
((1.f / len), 2)1.fgoal_vel=(norm * move)'

Tharindu Mathew
@mackiem
Mar 05 2018 21:58
chai.add(chaiscript::bootstrap::standard_library::vector_type<data_list>("DataList"));
i'm trying to follow the example, is that the way to go
Tyler Lewis
@tlewiscpp
Mar 05 2018 21:59
Yeah, try to export the vector_type with chaiscript::bootstrap
Tharindu Mathew
@mackiem
Mar 05 2018 22:08
ok that seems to work
Tyler Lewis
@tlewiscpp
Mar 05 2018 22:08
Cool!
Tharindu Mathew
@mackiem
Mar 05 2018 22:08
what is the significance of the string name you pass? i.e. "DataList", is it like a typedef
Tyler Lewis
@tlewiscpp
Mar 05 2018 22:09
I believe (anyone else can chime in here) it's so you can instantiate it from within ChaiScript if you want
var someVar = DataList(item1, item2)
Tyler Lewis
@tlewiscpp
Mar 05 2018 22:16
Or actually, more like
var someVar = DataList();
someVar.push_back(item1);
someVar.push_back(item2);
//...etc