Replies: 3 comments
-
Note that the old Lua files have been left in the repo for reference when re-implementing in sol. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Added the helper functions |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closing this because it was abandoned. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In 3.0 we're hopefully switching from our custom Lua abstractions to sol.
The port has not been completed yet and progress is pushed to the 3.XDev branch.
It's very important that you DO NOT push to or make pull requests for 3.XDev if you want your change in the next 2.X release.
We will NOT be merging 3.XDev into 2.XDev.
We WILL be merging 2.XDev into 3.XDev occasionally and one final time when we're all done with 2.X releases.
There is currently a problem with the build configuration that causes us to rebuild luajit every time we build UE4SS, and this is to stop the mixing of debug/release binaries.
If you want to contribute to the sol port, there are several macros available to help you.
The
CHOOSE_FREE_OVERLOAD
macro takes a function name and any parameter types for the function.The
CHOOSE_MEMBER_OVERLOAD
macro takes a struct name, function name and the parameter types for the function.The
CHOOSE_CONST_MEMBER_OVERLOAD
macro is identical to 'CHOOSE_MEMBER_OVERLOAD' but targets const member functions.The three macros above are meant to be used with
new_usertype
andset_function
from sol.The
REGISTER_SOL_SERIALIZER
macro takes an FProperty type and equivalent C++ type and registers a sol handler for the property.This macro only works if the property doesn't need any special handling.
Note that this only creates the handler function, you still need to register the handler with
add_property_pusher
inSolMod::on_program_start
.The
EXIT_NATIVE_HOOK_WITH_ERROR
macro takes a loop action (break or continue) or void if not in a loop, a 'LuaUnrealScriptFunctionData' struct, and an error message.It outputs the error message and then stops script execution.
The
exit_script_with_error
function takes the number of Lua return values (template param), sol::state and an error message.It outputs the error message and returns the given number of 'nil' values to Lua.
Always use this function if you're Lua function has failed in some way instead throwing a C++ exception or using 'luaL_error' because this way the script can check for the 'nil' return values.
The
exit_callback_with_values
function takes a sol::state and a variadic number of values to return to the script from this function.This is a helper function if you have multiple return values, otherwise returning it normally will work fine.
The
call_function_wrap_params_safe
function takes either a pre-wrapped param (vector<ParamPtrWrapper>
) or a variadic number of unwrapped params which it then wraps before calling the Lua function.The
call_function_dont_wrap_params_safe
function takes either a pre-wrapped param (vector<ParamPtrWrapper>
) in which case it will redirect it to the pre-wrapped handler, or a variadic number of unwrapped params which it then passes directly to the Lua function without wrapping them.We're making the change to sol as a 3.0 release because there may be breaking changes for Lua scripts, and this is in part because we've also changed from Lua 5.4 to luajit which uses Lua 5.1.
Beta Was this translation helpful? Give feedback.
All reactions