Skip to content

Commit 8b8262b

Browse files
committed
Refine Vector
1 parent 20bda4e commit 8b8262b

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

script.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ if (useStrings) then
2828
-- Use vector.
2929
else
3030
ec.callbackCallVector = function(key, vector)
31-
printValues("callVector", vector.strings)
31+
printValues("callVector", vector.values)
3232
v = Vector.new()
33-
v:setStrings({"Z", "A"})
33+
v:setValues({"Z", "A"})
3434
return v
3535
end
3636
end

src/EnvironmentClient.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class EnvironmentClient
4949
else if (this->callbackCallVector)
5050
{
5151
Vector in;
52-
in.strings = values;
52+
in.values = values;
5353
Vector out = this->callbackCallVector(key, in);
54-
return out.strings;
54+
return out.values;
5555
}
5656
printf(
5757
"EnvironmentClient.call(%s, %s). provide callback!\n",

src/Vector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ struct Vector
1010
{
1111
Vector() { }
1212

13-
void setStrings(const Strings &strings)
13+
void setValues(const Strings &values)
1414
{
15-
this->strings = strings;
15+
this->values = values;
1616
}
1717

18-
Strings strings;
18+
Strings values;
1919
};
2020

2121
#endif // CPP_CALLBACK_SCRIPT_VECTOR_H

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ void runSol(const char *fileName)
8686
// Register vector class.
8787
lua.new_usertype<Vector>(
8888
"Vector",
89-
"strings", &Vector::strings,
90-
"setStrings",
91-
[](Vector &vector, sol::nested<Strings> strings)
89+
"values", &Vector::values,
90+
"setValues",
91+
[](Vector &vector, sol::nested<Strings> values)
9292
{
93-
return vector.setStrings(strings);
93+
return vector.setValues(values);
9494
}
9595
);
9696

0 commit comments

Comments
 (0)