Implemented the keyword argument parser.

This commit is contained in:
2022-07-22 16:00:37 -04:00
parent 4735c1fd7d
commit 001add12bf
7 changed files with 116 additions and 113 deletions

View File

@@ -1,7 +1,7 @@
#include "luastack.hpp"
#include "globaldb.hpp"
LuaDefine(global_once, "string", "for a given string, returns true exactly once") {
LuaDefine(global_once, "name", "for a given string, returns true exactly once") {
LuaArg name;
LuaRet flag;
LuaVar oncedb, val;
@@ -14,7 +14,7 @@ LuaDefine(global_once, "string", "for a given string, returns true exactly once"
return LS.result();
}
LS.checkstring(name);
LS.checkstring(name, "name");
LS.rawget(val, oncedb, name);
if (!LS.isnil(val)) {
LS.set(flag, false);
@@ -35,7 +35,7 @@ LuaDefine(global_clearonce, "name", "reset the specified once-flag") {
if (!LS.istable(oncedb)) {
return LS.result();
}
LS.checkstring(name);
LS.checkstring(name, "name");
LS.rawset(oncedb, name, LuaNil);
return LS.result();
}
@@ -45,7 +45,7 @@ LuaDefine(global_table, "globalname", "get a table where global data can be stor
LuaRet globaltab;
LuaVar globaldb;
LuaStack LS(L, globalname, globaltab, globaldb);
LS.checkstring(globalname);
LS.checkstring(globalname, "globalname");
// Get a pointer to the globaldb.
LS.rawget(globaldb, LuaRegistry, "globaldb");