mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Remove redundant check for narr and nrec variables in create_table
This commit is contained in:
parent
fdf145ecd8
commit
c241a3df92
@ -152,13 +152,7 @@ public:
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
table create_table(T&& key, int narr = 0, int nrec = 0) {
|
table create_table(T&& key, int narr = 0, int nrec = 0) {
|
||||||
if(narr == 0 && nrec == 0) {
|
|
||||||
lua_newtable(L.get());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lua_createtable(L.get(), narr, nrec);
|
lua_createtable(L.get(), narr, nrec);
|
||||||
}
|
|
||||||
|
|
||||||
table result(L.get());
|
table result(L.get());
|
||||||
lua_pop(L.get(), 1);
|
lua_pop(L.get(), 1);
|
||||||
global.set(std::forward<T>(key), result);
|
global.set(std::forward<T>(key), result);
|
||||||
@ -166,13 +160,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
table create_table(int narr = 0, int nrec = 0) {
|
table create_table(int narr = 0, int nrec = 0) {
|
||||||
if(narr == 0 && nrec == 0) {
|
|
||||||
lua_newtable(L.get());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lua_createtable(L.get(), narr, nrec);
|
lua_createtable(L.get(), narr, nrec);
|
||||||
}
|
|
||||||
|
|
||||||
table result(L.get());
|
table result(L.get());
|
||||||
lua_pop(L.get(), 1);
|
lua_pop(L.get(), 1);
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user