perbone / luascript

Lua language support for Godot Engine
Apache License 2.0
629 stars 44 forks source link

Integrating this project with LuaJIT #56

Closed kunrii closed 2 years ago

kunrii commented 2 years ago

Hello! I find your project to be interesting and I sent you an email but I think other people would also be interested in this so I hope you don't mind if I open an issue. You mention in your project that you have support for multiple Lua interpreters:

Support for multiple Lua runtimes (PUC Rio Lua 5.4 and LuaJIT)

How can one add the LuaJIT runtime to this project?

In addition, I would like to ask, is this project compatible with Lua multithreading libraries such as this one (https://github.com/effil/effil)?

Thank you for your time!

perbone commented 2 years ago

Hi kunrii, So the way I see at the moment, to test luajit is a matter of doing a drop in into folder libs/lua as I think Lua and LuaJit are API compatible. But, I'm using the Lua 5.4 API so not sure if the old LuaJit still is really compatible. To be honest with you I'm not sure it is worth to use LuaJit in Godot as it is not a high performance engine. I doubt if the Lua run speedy can be a bottleneck. About threading, it is a lot more complex, not just the use of a library. We have to follow the engine's tread model and I'm not there yet. Hope this helps Perbone

kunrii commented 2 years ago

I assume that so long as you don't call any Lua 5.4 methods it's going to work. And I'm happy to report that I did what you said and the project at least compiles correctly with LuaJIT and the engine appears to work fine (current Godot master, target Windows 10 64 bit)

But I have one question, how do we actually use this module? Do you have an example of a sample script? Such as, how do we call Godot API functions, and how do we tap into godot API functions such as void _ready ( )? If you already have an example script or this written out somewhere I'm sorry, just point me to it. I'm actually really excited to be able to use this in my game.

perbone commented 2 years ago

I assume that so long as you don't call any Lua 5.4 methods it's going to work. And I'm happy to report that I did what you said and the project at least compiles correctly with LuaJIT and the engine appears to work fine (current Godot master, target Windows 10 64 bit)

That's great!

But I have one question, how do we actually use this module? Do you have an example of a sample script? Such as, how do we call Godot API functions, and how do we tap into godot API functions such as void _ready ( )? If you already have an example script or this written out somewhere I'm sorry, just point me to it. I'm actually really excited to be able to use this in my game.

Sorry at the moment I'm still working on the editor code, did not start on the runtime code. I have little time to work on this project so I'm afraid it is a slow pace.

Thanks for your interest.