Hi, all!
I need to implement custom plain text resource type and use it as script (Lua).
I looked at quite some tutorials and none worked. Is there some working
example which works for Ogre master branch?
How to implement custom resource? Topic is solved
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
How to implement custom resource?
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: How to implement custom resource?
Generally I need for Ogre resource system to load/unload it on demand from defined paths,
if resource system is overkill for that I'd like to see alternate solutions.
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: How to implement custom resource?
Found much simpler way:
Code: Select all
Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource("data.lua", "LuaScripts", NULL, false);
Now I want to load all Lua scripts...
-
- OGRE Team Member
- Posts: 2180
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1168
Re: How to implement custom resource?
why dont you use plain std::ifstream?
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: How to implement custom resource?
This is simply perfect:
Code: Select all
Ogre::DataStreamList streams = Ogre::ResourceGroupManager::getSingleton().openResources("*.lua", "LuaScripts");
while (!streams.empty()) {
Ogre::DataStreamPtr s = streams.front();
std::cout << "stream: " << s->getAsString() << "\n";
streams.pop_front();
luaL_dostring(L, s->getAsString().c_str());
}
Last edited by slapin on Sat Jun 07, 2025 8:24 pm, edited 1 time in total.
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: How to implement custom resource?
Because I want Ogre to load for me, for cross-platforminess and less problems sake.
Otherwise I'll have to invent the same thing forever. Ogre has its resource paths and groups
so all I need is to use them.