The official documentation isn’t 100% clear on things (why am I getting LUA_TNIL
for functions?), and the best I can find with some simple web search is kinda relevant stackoverflow (🤮) posts, except they’re mostly about calling host functions from Lua side, the rest are things that seem I’ve nailed so far.
EDIT: Solution was that everyone was using luaL_dofile
, while I was forward thinking and used lua_load
instead, which isn’t a macro, and as such doesn’t do an initial lua_pcall
. Now I do it manually, and now I get different, but less cryptic and actually documented errors. Now I just have to wrestle with D metaprogramming features (very strong and capable, but is a rabbit hole itself).
Not really sure what you’re trying to achieve here. Do you have an application that lets you use Lua extensions? Or do you want to build an application that lets you use Lua extensions?
Whats the host language you try to embed lua into?
D.
It has C ABI compatibility, so it should work. But as others wrote, I might have messed up my Lua script.
Upvote for D, underrated lang.
let me take a guess, gta online modder ?
No, I’m developing my own engine.
One Lone Coder has made few videos about adding Lua scripting to a C++ program, maybe it has what you’re looking for: Embedding Lua in C++ #1
Well, reference manual was enough for me. There’ nothing difficult. You probably have troubles with your lua code, try executing it in the standalone interpreter.