Reworking the keyword parser, also fixed some dynamic linking issues
This commit is contained in:
@@ -834,18 +834,20 @@ void PlaneScan::configure(LuaKeywordParser &kp) {
|
||||
bool have_shape = false;
|
||||
bool have_near = false;
|
||||
|
||||
if (kp.parse(val, "plane")) {
|
||||
kp.check_throw();
|
||||
|
||||
if (kp.optional(val, "plane")) {
|
||||
plane_ = LS.ckstring(val, "plane");
|
||||
have_plane = true;
|
||||
}
|
||||
|
||||
if (kp.parse(val, "center")) {
|
||||
if (kp.optional(val, "center")) {
|
||||
util::DXYZ xyz = LS.ckxyz(val, "center");
|
||||
center_ = xyz;
|
||||
have_center = true;
|
||||
}
|
||||
|
||||
if (kp.parse(val, "radius")) {
|
||||
if (kp.optional(val, "radius")) {
|
||||
auto simple = LS.trynumber(val);
|
||||
if (simple) {
|
||||
radius_ = *simple;
|
||||
@@ -862,7 +864,7 @@ void PlaneScan::configure(LuaKeywordParser &kp) {
|
||||
}
|
||||
}
|
||||
|
||||
if (kp.parse(val, "shape")) {
|
||||
if (kp.optional(val, "shape")) {
|
||||
eng::string shape = LS.ckstring(val, "shape");
|
||||
if (shape == "box") {
|
||||
shape_ = BOX;
|
||||
@@ -876,7 +878,7 @@ void PlaneScan::configure(LuaKeywordParser &kp) {
|
||||
have_shape = true;
|
||||
}
|
||||
|
||||
if (kp.parse(val, "near")) {
|
||||
if (kp.optional(val, "near")) {
|
||||
int64_t id = LS.tanid(val);
|
||||
if (id == 0) {
|
||||
luaL_error(L, "scan configuration: 'near' must be a tangible");
|
||||
@@ -893,14 +895,14 @@ void PlaneScan::configure(LuaKeywordParser &kp) {
|
||||
have_near = true;
|
||||
}
|
||||
|
||||
if (kp.parse(val, "include")) {
|
||||
if (kp.optional(val, "include")) {
|
||||
if (!have_near) {
|
||||
luaL_error(L, "scan configuration: 'include' specified without 'near'");
|
||||
}
|
||||
include_near_ = LS.ckboolean(val, "include");
|
||||
}
|
||||
|
||||
if (kp.parse(val, "wholeplane")) {
|
||||
if (kp.optional(val, "wholeplane")) {
|
||||
if (have_plane || have_center || have_radius || have_shape) {
|
||||
luaL_error(L, "scan configuration: do not specify plane, center, shape, or radius with 'wholeplane'");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user