Console overhaul, part 2. New console is mostly working.
This commit is contained in:
@@ -325,6 +325,14 @@ bool LuaCoreStack::next(LuaSlot tab, LuaSlot key, LuaSlot value) const {
|
||||
|
||||
eng::string LuaCoreStack::load(LuaSlot result, std::string_view code, std::string_view context)
|
||||
{
|
||||
// We interpret "=x" as syntactic sugar for "return x"
|
||||
eng::string expanded;
|
||||
if (sv::has_prefix(code, "="))
|
||||
{
|
||||
expanded = eng::string("return ") + eng::string(code.substr(1));
|
||||
code = expanded;
|
||||
}
|
||||
|
||||
eng::string fullcontext = eng::string("=") + eng::string(context);
|
||||
luaL_loadbuffer(L_, code.data(), code.size(), fullcontext.c_str());
|
||||
int type = lua_type(L_, -1);
|
||||
|
||||
Reference in New Issue
Block a user