At this point, most functions have been LuaStack refactored
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
LuaDefine(makeclass, "classname", "create a class if it doesn't already exist") {
|
||||
LuaArg classname;
|
||||
LuaRet classtab;
|
||||
LuaOldStack LS(L, classname, classtab);
|
||||
LuaDefStack LS(L, classname, classtab);
|
||||
if (!LS.isstring(classname)) {
|
||||
luaL_error(L, "class name must be a string");
|
||||
}
|
||||
@@ -35,7 +35,7 @@ LuaDefine(makeclass, "classname", "create a class if it doesn't already exist")
|
||||
LuaDefine(getclass, "classname", "get the classtab with the specified name") {
|
||||
LuaArg classname;
|
||||
LuaRet classtab;
|
||||
LuaOldStack LS(L, classname, classtab);
|
||||
LuaDefStack LS(L, classname, classtab);
|
||||
eng::string err = LS.getclass(classtab, classname);
|
||||
if (err != "") {
|
||||
luaL_error(L, "%s", err.c_str());
|
||||
@@ -46,7 +46,7 @@ LuaDefine(getclass, "classname", "get the classtab with the specified name") {
|
||||
LuaDefine(classname, "classtable", "get the class name from a class table") {
|
||||
LuaArg table;
|
||||
LuaRet result;
|
||||
LuaOldStack LS(L, table, result);
|
||||
LuaDefStack LS(L, table, result);
|
||||
eng::string rstr = LS.classname(table);
|
||||
if (rstr == "") {
|
||||
LS.set(result, LuaNil);
|
||||
@@ -78,7 +78,7 @@ static void get_info_table(LuaCoreStack &LS, LuaSlot db, LuaSlot info, const eng
|
||||
|
||||
static void calculate_loadresult(LuaCoreStack &LS0, LuaSlot info, const eng::string &fn, const eng::string &code) {
|
||||
LuaVar loadresult;
|
||||
LuaOldStack LS(LS0.state(), loadresult);
|
||||
LuaExtStack LS(LS0.state(), loadresult);
|
||||
if (code == "") {
|
||||
LS.rawset(info, "loadresult", "missing or empty source file");
|
||||
} else {
|
||||
@@ -250,7 +250,7 @@ void SourceDB::update(const util::LuaSourceVec &source) {
|
||||
//
|
||||
static void source_clear_globals(lua_State *L) {
|
||||
LuaVar classname, classtab, key, globtab, classes;
|
||||
LuaOldStack LS(L, classname, classtab, key, globtab, classes);
|
||||
LuaExtStack LS(L, classname, classtab, key, globtab, classes);
|
||||
|
||||
LS.getglobaltable(globtab);
|
||||
LS.cleartable(globtab, true);
|
||||
@@ -263,7 +263,6 @@ static void source_clear_globals(lua_State *L) {
|
||||
assert(LS.istable(classtab));
|
||||
LS.cleartable(classtab, true);
|
||||
}
|
||||
LS.result();
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +469,7 @@ void SourceDB::deserialize_source(util::LuaSourceVec *sv, StreamBuffer *sb) {
|
||||
|
||||
// This function should not touch the dlmalloc heap.
|
||||
void SourceDB::register_lua_builtins() {
|
||||
lua_State *L = LuaOldStack::newstate(nullptr);
|
||||
lua_State *L = LuaCoreStack::newstate(nullptr);
|
||||
luaL_openlibs(L);
|
||||
LuaVar globals, lclassname, lfuncname, classtab, func;
|
||||
LuaOldStack LS(L, globals, lclassname, lfuncname, classtab, func);
|
||||
@@ -766,7 +765,7 @@ LuaSandboxBuiltin(math_log10, "", "");
|
||||
LuaNumberConstant(math_pi, M_PI, "");
|
||||
LuaNumberConstant(math_huge, HUGE_VAL, "");
|
||||
LuaNumberConstant(math_nan, NAN, "");
|
||||
LuaNumberConstant(math_maxint, LuaOldStack::MAXINT, "");
|
||||
LuaNumberConstant(math_maxint, LuaCoreStack::MAXINT, "");
|
||||
|
||||
// math.random and math.randomseed are in world-accessor.cpp, because
|
||||
// generating random numbers must manipulate global state which is
|
||||
|
||||
Reference in New Issue
Block a user