add 'camera' library

This commit is contained in:
MihailRis
2024-07-12 06:14:13 +03:00
parent 24ecb94942
commit ffb7aa1189
6 changed files with 56 additions and 26 deletions
+18
View File
@@ -0,0 +1,18 @@
#include "api_lua.hpp"
#include "../../../content/Content.hpp"
#include "../../../world/Level.hpp"
using namespace scripting;
int l_index(lua::State* L) {
auto name = lua::require_string(L, 1);
auto& indices = content->getIndices(ResourceType::CAMERA);
std::cout << "index: " << name << std::endl;
return lua::pushinteger(L, indices.indexOf(name));
}
const luaL_Reg cameralib [] = {
{"index", lua::wrap<l_index>},
{NULL, NULL}
};