Skip to content

Commit

Permalink
Merge branch 'praydog:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyhodge authored Oct 26, 2024
2 parents f02df96 + 470fe85 commit 3918685
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/mods/bindings/Sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ sol::object parse_data(lua_State* l, void* data, ::sdk::RETypeDefinition* data_t
sol::object get_native_field(sol::object obj, ::sdk::RETypeDefinition* ty, const char* name);
sol::object get_native_field_from_field(sol::object obj, ::sdk::RETypeDefinition* ty, ::sdk::REField* field);
sol::object get_field_or_method(sol::object obj, const char* name);
void set_native_field(lua_State* l, sol::object obj, ::sdk::RETypeDefinition* ty, const char* name, sol::object value);
void set_native_field(sol::this_state s, sol::object obj, ::sdk::RETypeDefinition* ty, const char* name, sol::object value);

struct ValueType {
std::vector<uint8_t> data{};
Expand Down Expand Up @@ -1055,9 +1055,10 @@ void set_native_field_from_field(sol::object obj, ::sdk::RETypeDefinition* ty, :
set_data(data, field_type, value);
}

void set_native_field(lua_State* l, sol::object obj, ::sdk::RETypeDefinition* ty, const char* name, sol::object value) {
void set_native_field(sol::this_state s, sol::object obj, ::sdk::RETypeDefinition* ty, const char* name, sol::object value) {
const auto field = ty->get_field(name);
if (field == nullptr) {
auto l = s.lua_state();
//throw sol::error("Attempted to set invalid REManagedObject field:" + std::string(name));
luaL_traceback(l, l, ("Attempted to set invalid REManagedObject field:" + std::string(name)).c_str(), 1);
std::string traceback_err = lua_tostring(l, -1);
Expand Down Expand Up @@ -1686,7 +1687,7 @@ void bindings::open_sdk(ScriptState* s) {
return;
}

return api::sdk::set_native_field(s->lua(), sol::make_object(s->lua(), obj), utility::re_managed_object::get_type_definition(obj), name, value);
return api::sdk::set_native_field(sol::this_state{s->lua()}, sol::make_object(s->lua(), obj), utility::re_managed_object::get_type_definition(obj), name, value);
},
"call", [s](REManagedObject* obj, const char* name, sol::variadic_args args) {
if (obj == nullptr) {
Expand Down

0 comments on commit 3918685

Please sign in to comment.