Console overhaul, part 2. New console is mostly working.

This commit is contained in:
2025-12-09 15:51:35 -05:00
parent 2d1def8dc6
commit a0703effc3
10 changed files with 51 additions and 21 deletions

View File

@@ -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);