| 2 | #include "Scripting/Internal/ScriptUtil.h" |
| 3 | |
| 4 | sol::table MakeSpecialTableBase(sol::state* state, const std::string& name) |
| 5 | { |
| 6 | std::string metaName{ name + "Meta" }; |
| 7 | auto meta = sol::table{ *state, sol::create }; |
| 8 | state->set(metaName, meta); |
| 9 | |
| 10 | meta.set("__metatable", "\"metatable is protected\""); |
| 11 | state->safe_script("rawset(_G, \"" + name + "\", {})"); |
| 12 | |
| 13 | auto tab = (*state)[name]; |
| 14 | tab[sol::metatable_key] = meta; |
| 15 | state->set(metaName, sol::nil); |
| 16 | |
| 17 | return meta; |
| 18 | } |
no test coverage detected