Add VALIDATE_LUA as a function in lpxserver and lpxclient
This commit is contained in:
@@ -20,14 +20,21 @@ public:
|
||||
LuaConsole console_;
|
||||
PrintChanneler print_channeler_;
|
||||
eng::vector<Invocation> delayed_invocations_;
|
||||
lua_State *lua_syntax_checker_;
|
||||
|
||||
public:
|
||||
LpxClient() {
|
||||
lua_syntax_checker_ = LuaCoreStack::newstate(eng::l_alloc);
|
||||
|
||||
set_console_prompt(console_.get_prompt());
|
||||
|
||||
set_initial_state_standalone();
|
||||
}
|
||||
|
||||
~LpxClient() {
|
||||
lua_close(lua_syntax_checker_);
|
||||
}
|
||||
|
||||
void set_initial_state_connect(const eng::string &hostspec) {
|
||||
// Create the world model.
|
||||
world_.reset(new World(WORLD_TYPE_PREDICTIVE));
|
||||
@@ -256,6 +263,13 @@ public:
|
||||
set_initial_state_connect(util::ss("nocert:", datapk, ":8085"));
|
||||
break;
|
||||
}
|
||||
case AccessKind::VALIDATE_LUA: {
|
||||
LuaVar closure;
|
||||
LuaDefStack LS(lua_syntax_checker_, closure);
|
||||
eng::string errmsg = LS.load(closure, datapk, "stdin");
|
||||
retpk->write_bytes(errmsg);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
util::dprint("Invalid event_access: ", int(kind));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user