static int PlayerCharacterL_Show(lua_State* luaVM) { int nargs = lua_gettop(luaVM); switch(nargs) { case 3: { PlayerCharacter* playerCharacter = luaW_check<PlayerCharacter>(luaVM, 1); if (playerCharacter) { int x = lua_tointeger(luaVM, 2); int y = lua_tointeger(luaVM, 3); playerCharacter->addToMap(shapes::Point2D(x, y)); } break; } } return 0; }
static int PlayerCharacterL_Show(lua_State* luaVM) { PlayerCharacter* playerCharacter = luaW_check<PlayerCharacter>(luaVM, 1); if (playerCharacter == nullptr) { return lua_error(luaVM); } int x; if(!ScriptUtilities::getParameter(luaVM, 2, 1, "x", x)) { return lua_error(luaVM); } int y; if(!ScriptUtilities::getParameter(luaVM, 2, 2, "y", y)) { return lua_error(luaVM); } playerCharacter->addToMap({ x, y }); return 0; }