Skip to content

Commit

Permalink
this works, for me at leats
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 14, 2023
1 parent 9cd1bdf commit 3559c03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/game_api/script/sol_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct usertype_container<ZeroIndexArray<T>>
static int size(lua_State* L)
{
ZeroIndexArray<T>& v = sol::stack::get<ZeroIndexArray<T>&>(L, 1);
return stack::push(L, v.size());
return sol::stack::push(L, v.size());
}
// Used by default implementation
static auto begin(lua_State*, ZeroIndexArray<T>& self)
Expand Down
13 changes: 6 additions & 7 deletions src/game_api/script/usertypes/sound_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,20 @@ void register_usertypes(sol::state& lua, SoundManager* sound_manager)
"set_parameter",
&PlayingSound::set_parameter);

auto left_channel = sol::property([&lua](SoundMeta* sm)
{ return ZeroIndexArray<float>(sm->left_channel); });
auto right_channel = sol::property([](SoundMeta* sm)
{ return ZeroIndexArray<float>(sm->right_channel); });

lua.new_usertype<SoundMeta>(
"SoundMeta",
"x",
&SoundMeta::x,
"y",
&SoundMeta::y,
"left_channel",
left_channel,
//&SoundMeta::left_channel,
sol::property([](SoundMeta* sm)
{ return ZeroIndexArray<float>(sm->left_channel) /**/; }),
"right_channel",
right_channel,
//&SoundMeta::right_channel,
sol::property([](SoundMeta* sm)
{ return ZeroIndexArray<float>(sm->right_channel) /**/; }),
"start_over",
&SoundMeta::start_over,
"playing",
Expand Down

0 comments on commit 3559c03

Please sign in to comment.