English Structuring Lua C modules in CS2D. Suggestions?

6 replies
Goto Page
To the start Previous 1 Next To the start
Up
MikuAuahDark
User
Offline Off
So I've successfully wrote my CS2D Lua wrapper (Thread: thread cs2d Calling CS2D's statically Lua function. Legal?) and now I need suggestion about how to structure the DLLs/.so

What is CS2D Lua Wrapper >


First approach would be having liblua5.1.so/lua51.dll act as the wrapper itself and Lua C modules compiled depends on that DLL/shared object.
√ In case of CS2D update, only single file needs to be updated.
× In Linux, CS2D (dedicated server) must be run with
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./CS2D


A second approach would be compiling the C modules and the CS2D Lua wrapper together. It's just single file "cs2dlua.c" that must be added to module compilation.
√ No need of specialized command to run the CS2D (dedicated server)
× In case of CS2D update, all modules must be recompiled

I'm also open to other suggestion that maybe interesting.

Regards,
AuahDark
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
06.01.20 12:06:24 pm
Up
ohaz
User
Offline Off
setting the LD_LIBRARY_PATH is rather common and should be the preferred way in this case. As you usually start cs2d automated anyways, nobody ever needs to enter this more than once so it's fine.
https://ohaz.engineer - Software Engineering
09.01.20 02:35:56 pm
Up
MikuAuahDark
User
Offline Off
I see, thanks. I'll distribute the wrapper when I have all Lua API functions mapped.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
10.01.20 09:00:00 am
Up
Gaios
Security Supporter
Offline Off
And what will you write with that?
11.01.20 06:45:49 am
Up
MikuAuahDark
User
Offline Off
That's good question actually. For now, I have Lua SQLite3 working with this technique. Still can't figure out how to compile LuaSocket yet, but my guess it just works.

Or maybe I can use this to bring LuaJIT back. Maybe.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
11.01.20 09:36:14 am
Up
Gaios
Security Supporter
Offline Off
@user MikuAuahDark: I was using SQLite without your LuaWrapper.. I don't understand this project

Maybe at least do MoonScript for CS2D that compiles by CS2D in fly.
11.01.20 01:13:32 pm
Up
MikuAuahDark
User
Offline Off
That means your module is basically in inconsistent state since there are 2 Lua VMs (one by CS2D and one by your SQLite module) which is undefined behavior. See this posts for memory error what I'm talking about.
file cs2d LuaJIT for Dedicated Server (11) JIT POWER! | Know your Lua errors! | Draw stuff at Pixelize Art --xx-- server!
To the start Previous 1 Next To the start