Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way of adding lua modules ? #71

Open
FkinGuy opened this issue Nov 14, 2024 · 3 comments
Open

Any way of adding lua modules ? #71

FkinGuy opened this issue Nov 14, 2024 · 3 comments

Comments

@FkinGuy
Copy link

FkinGuy commented Nov 14, 2024

I intend to use lua to make api calls, because it is much less cumbersome than blueprints when it comes to formating a string or extracting data from json. I tried to add a pure lua implementation of "requests" but it fails because it needs network support from the engine.

Is there any way to add not-pure-lua modules to the lua engine used here, like you would do with luarocks ?

Blueprints are very good for certain things, C++ for others, but I think there is still room for a traditional scripting engine too.

@FkinGuy
Copy link
Author

FkinGuy commented Nov 14, 2024

Also, I noticed the discord link, in this repo and others, is expired :)

@rdeioris
Copy link
Owner

You definitely want to embed c lua modules in the core itself (allowing the load of .so/.dll will basically break every security measure). This is probably one of the best articles on the topic: https://leiradel.github.io/2020/03/01/Embedding-Lua-Modules.html

In your case embedding luasockets should be enough.

Regarding the discord link it is still valid (there are people still joining even today), which error are you getting ?

@inspire22
Copy link

Did you get this working? I'm still in early stages but trying to grasp how the pipeline will be if I use lua for a lot of code (as it's a much more comfortable environment for me than C++ or blueprints).

Would we hack the additional embeds into LuaState.cpp? Looks like that's where the preload table is added.

This SO post talks about including socket+mime (required)
https://stackoverflow.com/questions/2197144/how-could-i-embedded-socket-in-lua-internally-just-like-oslib-debuglib

I was hoping to get mysql database access (for the server) via lua as well, but it sounds more complicated - maybe the luasql library isn't made for full c++ importing & needs additional prototype classes? https://stackoverflow.com/questions/12236032/how-to-embed-luasql-sqlite3-in-a-statically-linked-c-program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants