TheMaverickProgrammer / OpenNetBattle

An open source card-based battle engine written in modern C++
GNU General Public License v3.0
197 stars 41 forks source link

Lua sprites: AddTag(...) crash #234

Closed TheMaverickProgrammer closed 1 year ago

TheMaverickProgrammer commented 1 year ago

add_tags crashed the game. The docs say we sprite_node:add_tags( "arm" ), but when I do this I told it has to be a table and I can't just do a String as input. But then when I player:sprite():add_tags({"tag"}), the game crashes.

This is because the C++AddTags(...) uses a vector, and the lua add_tags(...) uses an initializer_list instead, so it's sending in the "wrong" data.

Also, sol doesn't like initializer_list. I forget the reasoning, but it has something to do with the fact the vector must be copied. We also cannot pass a const reference from lua to C++!!

So this is definitely a function needed to be looked at and fixed.