otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.58k stars 1.05k forks source link

A potential solution to luascript.cpp length #3504

Open Zbizu opened 3 years ago

Zbizu commented 3 years ago

This doesn't quite fit to any of the issue templates so I'll try to improvise.

The problem

luascript.cpp is too long and is causing some (CI?) tools to fail

Suggested solution

keeping lines such as this one: registerClass("Creature", "", LuaScriptInterface::luaCreatureCreate); to maintain the self-documenting style of code

move functions such as this one: static int luaCreatureCreate(lua_State* L); to a new file in a separate directory to reduce luascript.cpp size

Example for Creature class

in luascript.cpp: #include luascript/creature.h and the creature cpp/h would be located in:

Kamenuvol commented 3 years ago

I prefer like in otclient, just 'redirection' to c++ functions of given class

yamaken93 commented 3 years ago

I prefer like in otclient, just 'redirection' to c++ functions of given class

different kinda of lua bridge tho.

nekiro commented 3 years ago

Isn't a bad idea imo, but it will increase compilation time significantly

DSpeichert commented 3 years ago

luascript.cpp is too long and is causing some (CI?) tools to fail

Which ones fail now?

Zbizu commented 3 years ago

https://github.com/otland/forgottenserver/issues/2169

I had this in mind. Feel free to close if you consider it resolved.

DSpeichert commented 3 years ago

Maybe we should keep the discussion in the #2169, since they both bring up ways to do so.

Since now we don't have an active issue with the length of that file, current CI works fine (and we stopped using Travis CI), I don't think it's very high priority. There are many changes/rewrites of things in-flight as-is :)